advanced
Realtime and streaming APIs
Choose between WebSocket, Server-Sent Events, long polling, and WebRTC based on directionality, latency, scale, and infrastructure.
Realtime API interviews test protocol choice: WebSocket, Server-Sent Events, long polling, and WebRTC—by directionality, latency, scale, proxies, and infrastructure cost.
Subtopics: WebSocket APIs, SSE and long polling, and WebRTC basics.
On interviews: pick a channel for live notifications vs collaborative editing vs media, and describe auth, heartbeats, backpressure, and reconnect.
Common pitfalls: WebSocket everywhere through corporate proxies, no session auth on socket upgrade, and missing ordering or replay after disconnect.
Checklist:
- Match protocol to one-way vs bidirectional needs.
- Authenticate at connection and per message where needed.
- Plan heartbeats, idle timeouts, and reconnect IDs.
- Respect proxy buffering and horizontal scale constraints.