Whole systems · Intermediate · 11 min

Design a Chat System

Separate accepted messages, ordered history and each device’s catch-up position.

STEP 1 / 12
Define the messaging promise — isometric concept diagramA message API needs explicit delivery and effect semantics. Components: 1. Alice’s device. Representative clients, not a literal user count; 2. Connection gateway. Logical component or processing boundary. Connections: 1. Alice’s device to Connection gateway: Define the messaging promise; 2. Connection gateway to Alice’s device: Reply: Connection gateway. Illustrations are conceptual, not deployed capacity or user counts.Alice’s device → Connection gateway: Define the messaging promise1Connection gateway → Alice’s device: Reply: Connection gateway2Alice’s device: Representative clients, not a literal user count1Alice’s deviceRepresentative clients, not aliteral user countConnection gateway: Logical component or processing boundary2Connection gatewayLogical component or processingboundary
1Alice’s device2Connection gateway
  1. 1Alice’s device → Connection gatewayRequestDefine the messaging promise
  2. 2Connection gateway → Alice’s deviceReplyReply: Connection gateway

Conceptual illustration · figures do not imply user counts, deployed capacity or replica counts.

2 components visible · Alice’s device + Connection gateway highlighted

Orange: request / query · Blue: reply · Purple: event / control · Arrows show direction; speed is illustrative.

You’ll learn

  • Retry identity and membership checks protect message acceptance.
  • Ordering needs an explicit scope and authority.
  • Recovery must reconcile data, not merely reconnect transport.

PUT THE IDEA TO WORK

From learning to practice

RELATED PATTERNS

Publish–Subscribe ↗

Further reading

RFC6455 · WebSocket protocol ↗