Server Push

session.TriggerAction(name, data) fires an action on the originating connection from a background goroutine. The handler updates state and the rendered tree is pushed to the browser. The call returns a non-nil error when the session group has no live connections — checking it on every iteration is the documented goroutine-cancellation pattern (no done channel needed).

Try: Click Start and watch the counter tick up once per second. The goroutine on the server pushes each tick via session.TriggerAction("tick", {elapsed: …}). If you close the tab mid-run, the next TriggerAction returns an error and the goroutine exits — no leak.