Backend
SSE
Server-Sent Events stream text updates one way from server to browser over a long-lived HTTP connection, with automatic reconnection and event IDs built into the EventSource API. It is perfect for feeds, notifications and progress bars where the client only listens. Limits: one-directional, text-only, and a low connection cap on HTTP/1.1.
Purpose
Server-Sent Events stream a one-way feed of text events from server to browser over a single long-lived HTTP response, exposed through the browser's EventSource API with automatic reconnection and event IDs. It exists for the common case where only the server needs to push.
When to Use It
Great for live feeds, notifications, progress bars, log tailing and dashboards — anything where the client only listens. It is simpler than WebSockets and rides normal HTTP/HTTPS and existing infrastructure.
Choose WebSockets instead when the client must also send a steady stream of messages back.
Trade-offs
Simplicity and built-in reconnection are the wins; the limits are that it is one-directional, text-only (no binary), and bound by the browser's roughly six-connections-per-domain cap on HTTP/1.1 — HTTP/2 multiplexing relieves this.
Implementation
Respond with Content-Type: text/event-stream, keep the connection open, and write data: lines each terminated by a blank line; include an id: so the browser can resume with Last-Event-ID after a drop. Disable proxy buffering and send periodic comment lines as keep-alives.