Design interviews / Intermediate / 6 min
Design WhatsApp: ticks, offline inboxes and retries
Sent, delivered and read ticks from acks. Take Bob offline to fill his server inbox; drop acks and watch message ids stop duplicates.
Start the simulation → Change the load, break a part, watch what happens. Free, no sign-up.
In short
- What it is
- A chat app like WhatsApp stores each message on a server, pushes it to the receiver, and turns acks into sent, delivered and read ticks.
- Why it matters
- Phones go offline and networks drop packets, yet every message must arrive exactly once and in order.
- The trade-off
- Keeping an inbox per user costs storage until delivery; retries make sends reliable but need message ids so they are not duplicated.
- Say it in an interview
- "Persistent WebSocket per device, messages written to the receiver’s inbox with a client message id, push or queue until online, and delivered/read acks back to the sender."
Check yourself
What does a single tick on a WhatsApp message mean?
Answer: The chat server has stored it. The server acks once it has the message safely; two ticks come from Bob’s phone, blue ticks from opening the chat.
Bob’s phone is off. Where does Alice’s message wait?
Answer: In Bob’s inbox on the server, until his phone connects. The server keeps a per-user queue of undelivered messages and pushes them when the device reconnects.
Alice’s phone resends because an ack was lost. Why doesn’t Bob see the message twice?
Answer: The server recognises the message id it already stored and ignores the copy. A client-generated message id makes the send idempotent, so retries are safe.