Interview's MateSystem Design
Interview's Mate

System Design

Architecture & trade-offs

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
All topics/Real-Time Communication
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
Practice in AI HLD
Subtopics in Real-Time Communication (2)
OverviewPolling, SSE & WSFan-Out Push/Pull

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
Parent topic
Real-Time Communication
Next subtopic
Feed Fan-Out: Push vs. Pull (Hybrid)