Manual
WebSockets and SSE
Push to the browser with Server-Sent Events or WebSockets.
Introduction#
Swerve::publish() and Swerve::subscribe() move a message between workers; a request that keeps a WebSocket or a ServerSentEvents stream open relays what it receives to its own browser. See Realtime: SSE and WebSockets for both as complete chat rooms, and OrderedChannel for when the order between publishers also matters.
Guides#
- Realtime: SSE and WebSockets – Push to the browser with Server-Sent Events or WebSockets, across all workers.
Examples#
- All examples of this topic – 23 with their output.
Reference#
ServerSentEvents– A Server-Sent Events stream (EventSource in the browser) on a ClientRequest.WebSocket– A WebSocket connection (RFC 6455), server side, on a ClientRequest or any Duplex.WebSocketHandshake– The decision of WebSocket::handshake: the answer to a WebSocket handshake.