Skip to interview prep
Apexed

17. How would you design a real-time chat service?

HardSystem design

Technical

Type or dictate your answer. Your draft is saved on this device.

Show model answer

Clients keep persistent connections (WebSockets) to gateway servers. Messages go to a chat service that assigns an ID and timestamp, persists them (a partitioned store keyed by conversation), and fans them out through a pub/sub layer to the gateways holding recipients' connections.

Cover delivery and read receipts, ordering within a conversation, offline users (store and push notifications), presence, horizontal scaling of gateways, and end-to-end encryption trade-offs.

How would you design a real-time chat service — Software engineering interview question — Apexed