Compare

Side-by-side on the decisions that recur: TCP vs UDP, HTTP/2 vs HTTP/3, flow vs congestion control, L4 vs L7, forward vs reverse proxy, IPv4 vs IPv6 — with when to choose each.

Server-Sent EventsWebSockets
DirectionServer → client only; client uses ordinary requests to talk backFull duplex on one connection
ProtocolPlain HTTP response that never ends (text/event-stream)HTTP Upgrade handshake, then a framed binary protocol
PayloadUTF-8 text eventsText or binary frames
ReconnectionBuilt in: browser reconnects and sends Last-Event-IDYou write it: backoff, resubscribe, replay
InfrastructurePasses through any HTTP proxy/LB; works over HTTP/2 streamsNeeds Upgrade forwarded end to end; long-lived TCP through every hop
Browser limitsCounts toward HTTP/1.1 per-host connection limit (6); fine on HTTP/2Separate limit, but each is a whole connection
Choose this whenFeeds, notifications, progress, dashboards — the server talks, the client listens, and you want it to survive proxies with zero code.Chat, collaborative editing, games, anything where the client sends frequently and latency in both directions matters.