Networking & Protocols (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)
What are Server-Sent Events (SSE) and when should you choose SSE over WebSockets?
senior LevelSystem Design
In Simple Words: SSE provides unidirectional real-time streaming from Server to Client over standard HTTP:
- Sent with
Content-Type: text/event-stream. - Browser natively handles auto-reconnection via the
EventSourceJavaScript API. - Why Choose SSE over WebSockets:
- LLM AI chat streaming (ChatGPT text completion), live stock tickers, notification feeds.
- Simpler infrastructure: operates over standard HTTP/2, works through standard corporate proxies and firewalls without special WebSocket handling.