Module 6 4 lessons 57 min
Live updates
A new order has to appear on the restaurant's tablet the moment it's paid, and the customer wants to see it being cooked. Both apps ask every 2 seconds, and at the dinner rush most of our traffic is “any news?”
In this module
3 Read · 1 Lab
- 6.1Polling, SSE, WebSockets, pushAsk every few seconds, or keep a connection open. Four ways to get news to the restaurant and the customer, what each costs the server, and why polling is often enough.Read12 min
- 6.2Live updates across many serversThe restaurant's tablet is connected to server 1, but the new order lands on server 2. Redis pub/sub joins them. And when the tablet's Wi-Fi drops, it fetches what it missed from the database - the push is fast, the database is the truth.Read12 min
- 6.3Proof: 10,000 order screensLoad-test 10,000 open order screens asking every 5 seconds, then holding one connection each. Then send a new order through two servers, and cut a tablet's connection mid-rush.Read8 min
- 6.4Lab: Add live updates to the clinicTell patients in the waiting room the moment Dr. Rao is running late - from any server, without them refreshing.Lab25 min