System Design
2. Networking FundamentalsAnimated
Server-Sent Events (SSE)
The server pushes a one-way stream of events over HTTP.
The idea
SSE keeps an HTTP response open and writes events as they happen. Browsers reconnect automatically.
Watch it work
Press play, pause, or step through. Some animations have settings you can change.
- current message
- earlier
- failure or attack
The browser opens one long-lived HTTP request.
- step:
- 1/5
- from:
- Browser
- to:
- Server
1/5
Time runs downward. Solid arrows are requests, dashed arrows are replies.
Step by step
- 1Client opens a streaming request
- 2Server keeps it open
- 3Events are written as they occur
- 4Client reconnects if dropped
Where it is used
Live feeds, notifications, LLM token streaming.
Watch out for
One direction only, and proxies may buffer the stream.