0 day streak

A chat system is something like WhatsApp or Slack: people send messages that should appear on other people’s screens within a fraction of a second, in the right order, and never get lost. To push messages instantly, each online client keeps a long-lived connection (usually a WebSocket) open to one of many gateway servers, and a session registry records which server holds which user’s connection so a message can be routed there. The two interesting problems are ordering, typically solved by giving each conversation a sequence number assigned by a single owner, and delivery to people who are offline, which means storing messages durably and syncing them, plus push notifications, when the device reconnects.

In this lesson: A WebSocket fleet and message ordering.