Answer
| WebSocket | SSE (EventSource) | Long polling | |
|---|---|---|---|
| Direction | Bidirectional | Server → client only | Simulated push via repeated HTTP |
| Protocol | Upgraded TCP connection | HTTP streaming | Normal HTTP |
| Reconnect | Manual + heartbeats | Built-in auto-reconnect | New request each cycle |
| Binary | Yes | Text only | Either |
| Proxies/CDN | Sometimes tricky | HTTP-friendly | Easy |
Choose WebSocket: chat, collaborative editing, gaming.
Choose SSE: live feeds, notifications, stock tickers (one-way).
Choose long polling: legacy infra, firewalled environments.