In this lesson · topic 7 of 7
Topic 7
The chat system in review
3 min read
Predict first
Predict first
Predict first
Take away
- Chat needs a persistent connection per online user, held by thin gateway servers.
- Assign a sequence number per conversation on the server. It gives order, duplicate detection and catch-up.
- Delivery is at-least-once. Acknowledge, resend, and drop copies by number on the client.
- Holding for order removes misordering and delays the slowest messages.
- A gateway crash drops its users. They reconnect with backoff and catch up from their inbox.
- Store before you push. Offline delivery is then the same read as history.
- Presence is a heartbeat that expires. It can be late. Messages cannot.
Sources
- Ian Fette, Alexey Melnikov, RFC 6455: The WebSocket Protocol, IETF, 2011.
- Leslie Lamport, Time, clocks, and the ordering of events in a distributed system, Communications of the ACM, 1978.
- Tushar Deepak Chandra, Sam Toueg, Unreliable failure detectors for reliable distributed systems, Journal of the ACM, 1996.