Home
← All questions

WebSockets vs SSE vs long polling | Web Fundamentals

MediumPremiumWeb Fundamentals

Asked at Meta · Slack · Uber

Web Fundamentals interview practice: Choose the right real-time transport for chat, feeds, and live dashboards.

Answer

WebSocketSSE (EventSource)Long polling
DirectionBidirectionalServer → client onlySimulated push via repeated HTTP
ProtocolUpgraded TCP connectionHTTP streamingNormal HTTP
ReconnectManual + heartbeatsBuilt-in auto-reconnectNew request each cycle
BinaryYesText onlyEither
Proxies/CDNSometimes trickyHTTP-friendlyEasy

Choose WebSocket: chat, collaborative editing, gaming.
Choose SSE: live feeds, notifications, stock tickers (one-way).
Choose long polling: legacy infra, firewalled environments.

Premium question

Unlock the full model answer with Mentoxis Premium.

Unlock with Premium