Documentation
¶
Overview ¶
Package adapters-sse demonstrates Server-Sent Events (SSE) using the go-codex adapters/nethttp and adapters/chi adapters.
What this example shows ¶
- rest.AddSSERoute — registering a typed SSE route with request and event codecs
- nethttp.SSEHandler / nethttp.RegisterSSE — wiring SSE onto net/http
- chiadapter.SSEHandler / chiadapter.RegisterSSE — wiring SSE onto chi
- Path parameter codec validation on {id} via rest.PathParam.Codec
- rest.SSERouteHandle.BuildPath for validated URL assembly
- Codec validation on each event before it is written to the client
- Stats observer counting validation errors from rejected events
- rest.ResponseHeaderParam on SSE routes — custom response header committed on first send
- OpenAPI 3.1 spec generation including SSE routes
Click to show internal directories.
Click to hide internal directories.