Real-time updates: getting the server's news to the client
When the prompt says "live", "instantly" or "as it happens", the design has two separate problems, how the bytes reach the browser and how the server finds the one connection that should receive them, and most candidates only answer the first.
What you'll be able to do
- Choose between polling, long polling, server-sent events, WebSockets and WebRTC from the direction and rate of the traffic
- Price short polling against push in requests per second and average delay, and say when polling is the right answer anyway
- Route an event from the service that produced it to the stateful gateway that holds the user's connection
- Design reconnection with sequence numbers so a dropped client catches up without gaps or duplicates
Before this: back-of-the-envelope, queues-and-backpressure
Log in to read the rest of this lesson
When the prompt says "live", "instantly" or "as it happens", the design has two separate problems, how the bytes reach the browser and how the server finds the one connection that should receive them, and most candidates only answer the first. This walkthrough runs about 22 minutes, with runnable code you can edit and re-run as you read. A new account gets 7 days of Pro free, no card required.
Log in to continueThe first module of every track is free to read on the web: see what's open in System design.