DISTRIBUTED SYSTEMS & ARCHITECTURE · SUBTOPIC
Polling vs. SSE vs. WebSockets
Choose the simplest real-time transport for chat, AI streaming, dashboards, and games.
BeginnerPart of Real-Time Communication
Subtopics in Real-Time Communication (2)
In plain words
Polling is asking "are we there yet?" every 5 seconds. SSE is listening to a live radio broadcast (one-way). WebSockets is an open phone call where both sides talk anytime.
Think of it like…
Checking your mailbox repeatedly (Polling), subscribing to live radio news (SSE), or a two-way walkie-talkie (WebSocket).
Loading interactive diagram
Loading interactive exercise
Theory & how it works
Don’t overlook SSE for AI and dashboards
Because SSE uses plain HTTP/2, it works seamlessly through corporate proxies, auto-reconnects natively via browser EventSource, and powers almost every modern LLM streaming response!
Key points & practical guide
Summary checklist
- Polling wastes requests when idle
- SSE = best 1-way server push over plain HTTP
- WebSockets = bidirectional low-latency; scale with Redis Pub/Sub
When to use it
- SSE for token streaming, notifications, stock tickers
- WebSockets for chat, live whiteboards, gaming
Watch out for
- Using WebSockets when plain HTTP + SSE is simpler, or forgetting mobile background disconnects (need APNs/FCM push fallback)
Quick check
Loading quiz