System Design
Advanced

Design Global Chat and Messaging

Build durable messaging with presence, ordering, offline delivery, and cross-region scale.

45 min
3 sections
chat
messaging
multi-region
1
2
3

01. Separate message durability from connection state

Section 1 of 3

Messages belong in durable storage. WebSocket gateways manage online connections and ephemeral presence. This separation lets users reconnect, sync missed messages, and move between devices.

text
Message send:
Client -> regional gateway
  -> auth and conversation membership check
  -> message service assigns sequence
  -> durable write
  -> event stream
  -> fanout to online devices
  -> push notification for offline devices
Back to Course