Documentation
¶
Overview ¶
sse demonstrates the simplest SSE pattern in gogo: register an async route, install Server-Sent Events via res.SSE, and emit events on a timer with a keepalive ping every few seconds.
Run:
CGO_ENABLED=1 go run -tags gogo ./examples/sse
Then open the browser to http://localhost:3000/ — the embedded HTML page subscribes to /events via the standard EventSource API and renders each tick.
Or stream from the CLI:
curl -N http://localhost:3000/events
Click to show internal directories.
Click to hide internal directories.