A simple push channel
Server sent events, or SSE, let a server push a continuous stream of messages to a client over a single long lived HTTP response. Unlike WebSockets it is one directional, server to client only.
How it works
The client opens a normal HTTP request and the server replies with a content type of event stream, then keeps the connection open, writing events as they occur.
- The client opens one HTTP connection.
- The server streams text events as they happen.
- The browser reconnects automatically if the link drops.
When to choose it
SSE shines for dashboards, notifications, and live feeds where data flows mostly downstream. It rides on plain HTTP, so it works through proxies and benefits from built in automatic reconnection with event IDs that let the server resume from where the client left off. The limitations are no client to server messages on the same channel and, over HTTP1, a cap on concurrent connections per host.
Key idea
SSE streams server to client updates over one long HTTP response, with automatic reconnection but no upstream channel.