Skip to main content

Real-time Updates

Difficulty: Medium | Topic #16

What to Learn​

WebSockets for full-duplex persistent connections, SSE for server-to-client streams, long polling as a fallback; when to pick each; connection management at scale (sticky sessions or pub-sub relay).

Resources​

Covered by Problems​

ProblemDifficultyLink
Messaging App (WhatsApp)Medium→
Live Comments (FB Live)Medium→
Online AuctionMedium→
Online ChessHard→
Real-time Doc Collaboration (Google Docs)Hard→
Ride Sharing (Uber)Hard→
Stock Trading Platform (Robinhood)Hard→

Key Concepts to Master​

  • WebSocket handshake and upgrade process
  • SSE vs WebSockets — unidirectional vs bidirectional
  • Long polling overhead vs WebSocket connection cost at scale
  • Pub-sub relay (Redis Pub/Sub, Kafka) to fan out to WebSocket servers
  • Connection draining on server restarts