← InfraDraft

Social & Feed

Design a Chat System (WhatsApp / Messenger - Focus on WebSockets)

A real-time messaging platform maintaining persistent WebSocket connections, guaranteeing message delivery order and offline sync.

Open and Simulate this Architecture in InfraDraft

Core Architectural Components

WebSocket Connection Gateway

Holds millions of stateful, long-lived client connections.

Message Store

Durable, per-conversation ordered log of every message sent.

Presence Service

Tracks online/offline/typing status and broadcasts changes to relevant peers.

Message Delivery/Ack Tracker

Sent/delivered/read receipt state machine per message per recipient.

Push Notification Service

Wakes a recipient's device when they're not actively connected.

Group Chat Membership Service

Manages who's in a group and fans messages out to all current members.

Media Attachment Storage & CDN

Handles images/video/voice notes off the hot messaging path.

End-to-End Encryption Key Exchange

Establishes and rotates per-conversation keys the server itself can't read.