Exercise — Real-Time Communication: choose the right technique for a live system.

Topic: microservices, Real-Time Communication. Level: Intermediate.

Answer

Match the requirement to the mechanism. Examples: a stock **ticker** (server→client only) → SSE; a **chat app** (two-way, text/binary) → WebSocket + Redis backplane; a **video call** → WebRTC with a WebSocket signaling channel; a legacy dashboard behind strict proxies needing occasional updates → long polling; a rarely-changing status badge → short polling. Justify by direction, latency, scale, and infra constraints. ```text Requirement -> Choice live prices (one-way) -> SSE (auto-reconnect, HTTP-simple) chat / collaboration (two-way) -> WebSocket + pub/sub backplane video / voice call -> WebRTC (P2P) + WebSocket signaling progress bar of a long job -> SSE or long polling occasional status refresh -> short polling service-to-service streaming -> gRPC bidirectional streaming ```