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.
TCP vs UDPHTTP/2 vs HTTP/3Flow control vs Congestion controlSwitch vs RouterForward proxy vs Reverse proxyL4 load balancing vs L7 load balancingServer-Sent Events vs WebSocketsIPv4 vs IPv6ARP (IPv4) vs Neighbor Discovery (IPv6)Keep-alive (reuse) vs New connection per request
| Server-Sent Events | WebSockets | |
|---|---|---|
| Direction | Server → client only; client uses ordinary requests to talk back | Full duplex on one connection |
| Protocol | Plain HTTP response that never ends (text/event-stream) | HTTP Upgrade handshake, then a framed binary protocol |
| Payload | UTF-8 text events | Text or binary frames |
| Reconnection | Built in: browser reconnects and sends Last-Event-ID | You write it: backoff, resubscribe, replay |
| Infrastructure | Passes through any HTTP proxy/LB; works over HTTP/2 streams | Needs Upgrade forwarded end to end; long-lived TCP through every hop |
| Browser limits | Counts toward HTTP/1.1 per-host connection limit (6); fine on HTTP/2 | Separate limit, but each is a whole connection |
| Choose this when | Feeds, 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. |