WebSockets vs Server-Sent Events: choosing how your app pushes live updates
Server-Sent Events push one way, server to browser, over HTTP/HTTPS with automatic reconnection built in; WebSockets run two-way over a single TCP connection, text and binary. The connection limits, reconnection behavior and the decision by update direction, from MDN's documentation and RFC 6455, read 21 November 2026.
Per MDN's documentation and RFC 6455, read 21 November 2026: both Server-Sent Events (SSE) and WebSockets let a server push updates to a browser without the browser polling - but they are different shapes of pipe. SSE is a one-way stream, server to client, delivered as an ordinary HTTP response with the MIME type text/event-stream. A WebSocket, per RFC 6455, "enables two-way communication between a client ... and a remote host" over a single TCP connection, carrying text or binary in both directions. Most live-update features need only one of these. This article compares the two from the standards and MDN's own guides and names no default winner.
The core difference: who can talk
SSE is strictly server-to-client. MDN's guide is direct: "This is a one-way connection, so you can't send events from a client to a server." The browser side is the EventSource API: point it at a URL and events arrive as messages. If your client occasionally needs to talk back - a like, a filter change, a submitted form - separate ordinary HTTP requests alongside SSE are a valid architecture; the reply does not need the same pipe. WebSocket earns its place when both sides send continually - chat messages, cursor positions, game moves - where opening a new request per message is the thing you are avoiding. A WebSocket starts life as an HTTP request with an Upgrade: websocket header (RFC 6455 registers that keyword) and, once the handshake completes, both sides can send at any time over the same connection. That is why chat, multiplayer games and collaborative editing land on WebSockets, while dashboards, notification feeds and progress bars fit SSE.
Reconnection: built in vs your code
When an SSE connection drops in the normal case, the browser attempts to reconnect on its own - though reconnection is not unconditional: MDN's EventSource reference exposes a CLOSED readyState, an error event fired when a connection to an event source fails to open, and a close() method that ends the stream for good. MDN documents the retry field, which the server sends inside the stream: "If the connection to the server is lost, the browser will wait for the specified time before attempting to reconnect", with the value in milliseconds. The stream can also carry an id field per event, which sets the EventSource object's last event ID, so a server can tell what a reconnecting client has already seen. WebSockets give you the pieces instead: MDN's client guide shows the close event firing when the connection ends - whether the client closed it, the server closed it, or an error occurred - and its own example reconnects only when the page is restored from the bfcache. In other words, with WebSockets the reconnection policy (when, how often, with what backoff) is code your team writes and owns.
Connection limits worth knowing
MDN carries a warning that surprises many teams: when SSE is not used over HTTP/2, browsers cap the number of open connections - per MDN the limit is 6 per browser and domain, so six SSE connections across all tabs to one site, and the issue is marked "Won't fix" in Chrome and Firefox. Over HTTP/2, MDN notes, the maximum number of simultaneous HTTP streams is negotiated between server and client (default 100). A WebSocket is its own persistent connection rather than a held HTTP request, so the same six-connection HTTP cap does not apply to it; the costs move to your server, which holds one connection open per client either way. The practical read: a server-push feature on HTTP/1.1 with several tabs open can hit the SSE cap fast, and MDN's warning is the reason the HTTP/2 question belongs in your decision.
Data shapes and infrastructure
SSE carries text: each notification is a block of text terminated by a pair of newlines, per MDN's event-stream format. WebSockets carry text and binary - MDN's guide notes the server can send data exposed to clients as a Blob or ArrayBuffer, chosen by the WebSocket binaryType property. If your updates are JSON or short strings, both work; if you are pushing audio chunks, protobuf frames or anything already binary, WebSocket is the natural fit. On infrastructure, both ride the web's normal ports and TLS (wss:// is WebSocket over TLS), and SSE has the simpler shape on the server: a long-lived ordinary HTTP response. Neither protocol removes the real scaling question - your server still holds one open connection per live client - so capacity planning, not the protocol name, decides how many users one box serves.
How the choice usually plays out
Live dashboard, news or stock feed, build-progress bar, notification stream: SSE - one direction, automatic reconnection, plain HTTP plumbing, and a server that is just a streaming HTTP handler. Chat, presence, collaborative editing, multiplayer game, or anything where the client's messages are as frequent as the server's - ongoing two-way messaging, not just an occasional reply: WebSocket, one connection both directions. Occasional client replies on a mostly-server-push stream: SSE plus plain POST requests is a legitimate design. Binary payloads (media, protobuf, custom protocols): WebSocket. Many server-push streams per user across several browser tabs on HTTP/1.1: check MDN's six-connection warning first, or serve over HTTP/2 where the stream limit is negotiated. And when your client rarely sends anything at all, plain request-response HTTP with occasional polling is still a legitimate answer - both of these exist for when polling is the problem.
Sources, all read 21 November 2026: MDN, Using server-sent events (one-way connection; text/event-stream; event-stream format; retry reconnection time in milliseconds; id field sets last event ID; HTTP/1.1 six-connection limit marked "Won't fix" in Chrome and Firefox; HTTP/2 streams negotiated, default 100); MDN, EventSource; MDN, Writing WebSocket client applications (close event on client close, server close or error; reconnect on pageshow example; binary via Blob/ArrayBuffer and binaryType); RFC 6455, The WebSocket Protocol (two-way communication over a single TCP connection; Upgrade: websocket handshake; data and control frames).
Adding realtime updates to a product? Omnistu's Backend and APIs practice works on services, integrations and the data models behind your product - write to team@omnistu.com with what you are deciding.
Frequently asked questions
Can Server-Sent Events send data from the browser to the server?
No. MDN's guide states it plainly: SSE is a one-way connection - you can't send events from a client to a server over the event stream. The browser can always make ordinary HTTP requests alongside it, If client-to-server messages are occasional, SSE plus those ordinary requests is a valid architecture; WebSockets are built for ongoing two-way messaging, where both sides send continually.
Does EventSource reconnect automatically?
In the normal case, yes. Per MDN, if the connection to the server is lost, the browser waits for the reconnection time and then attempts to reconnect; the server controls that wait with the retry field, an integer number of milliseconds. But it is not unconditional: MDN's EventSource reference defines a CLOSED readyState, an error event fired when a connection fails to open, and close() to end the stream deliberately - your code should still handle the error event. WebSockets do not do this for you: MDN's client guide fires a close event when the connection ends, and your code decides when and how to open a new one.
Is there a limit to how many SSE connections a browser can have?
Per MDN's warning: over HTTP/1.1 the limit is 6 open connections per browser and domain - shared across all tabs to that domain - and the issue is marked "Won't fix" in Chrome and Firefox. Over HTTP/2 the maximum number of simultaneous HTTP streams is negotiated between server and client (default 100), so serving over HTTP/2 changes the picture. Check MDN's current page before relying on either number.
Can WebSockets send binary data?
Yes. MDN's guide notes the server can send binary data, exposed to clients as a Blob or an ArrayBuffer depending on the WebSocket binaryType property. SSE, by contrast, is a text format - each notification is a block of text terminated by a pair of newlines.
Which one is cheaper to run?
Neither protocol removes the underlying cost: your server holds one open connection per live client in both cases. SSE has the simpler server shape - a long-lived HTTP response with the text/event-stream MIME type - which can mean less new infrastructure, while a WebSocket endpoint speaks the RFC 6455 frame protocol after its Upgrade handshake. Capacity planning (connections per box, memory per connection) matters more than the protocol label.
When should I just use polling?
When updates are rare and seconds of delay are acceptable. Both SSE and WebSockets exist for when polling is the problem - frequent updates, tight latency, or many clients asking "anything new?" at once. For a dashboard that refreshes a few times an hour, a plain HTTP request on a timer is simpler than either.