Video in progress

For a new platform you have to choose between WebSocket, SSE over HTTP/2 and WebTransport (HTTP/3). What criteria do you use to evaluate them?

Today the reliable choices are WebSocket (two-way) or SSE over HTTP/2 (one-way). WebTransport offers streams without head-of-line blocking and datagrams, but browser and server support isn't complete yet.

📖 Answer

This is how I order the criteria.

1. Traffic shape. If it's server → client only, SSE is enough and works for free with HTTP infrastructure (CDN, WAF, auth, observability). If you need fast two-way exchange, WebSocket.

2. Infrastructure. Corporate proxies, WAFs and API gateways have to know WebSocket. SSE is a plain HTTP response, so it passes almost everywhere; you only need to turn off buffering (X-Accel-Buffering: no for Nginx).

  1. Head-of-line blocking. WebSocket and HTTP/2 run over TCP. If one packet is lost, the whole connection waits. On a mobile network with a lot of loss, that's noticeable in latency. WebTransport runs over QUIC: streams are independent, and there are unreliable datagrams too. For games, live media and telemetry this is a serious advantage.

  2. Ecosystem maturity. WebTransport isn't the same in every browser yet, and on the Java side server libraries are few and young. Not all load balancers and proxies support QUIC. For me this is the heaviest argument for now.

  3. Connection migration. With QUIC connection migration, the connection survives when you switch from Wi-Fi to mobile data. With WebSocket that's a reconnect and a resume.

My practical conclusion: for a business app (chat, notifications, dashboard) WebSocket or SSE, and I hide the transport layer behind an abstraction on the client. The protocol itself, the message format, seq, resume and ack, stays independent of the transport. Then when WebTransport matures later, you only swap the transport adapter, not the whole system.

For real-time media or games, I'd look at WebRTC or WebTransport right now, because there the TCP head-of-line problem becomes a business problem.