Persist first
Messages should be durably written before delivery fanout so transient socket failures do not become message loss.
Free WhatsApp breakdown
WhatsApp is not just “messages in a database plus WebSockets.” Strong answers separate durable message history from ephemeral connection state and explain what guarantees matter for delivery.
The pivot
Weak answers treat messaging as one system. Strong answers split it into at least two: durable message history and transient device/session state. That is the difference between “chat app” talk and production messaging reasoning.
Messages should be durably written before delivery fanout so transient socket failures do not become message loss.
Online devices need fast session lookup and receipt handling, but session state should not be treated like durable truth.
Offline devices need cursor-based catch-up instead of relying entirely on real-time delivery.
30-second answer shape
“I would separate durable message storage from ephemeral connection and presence state, because those have different latency and correctness needs.”
“I care about not losing messages, preserving conversation ordering where it matters, and letting offline devices catch up via cursor-based sync.”
“Presence can be soft-state, but message durability cannot. I would accept eventual consistency in presence to keep the delivery path fast.”
Common mistake
“Users connect by WebSocket and messages are stored in a database.” That skips the product guarantees people actually expect.
“The hard part is delivering messages with low latency while preserving durability, online/offline recovery, and conversation-level ordering.”
The interviewer hears that you understand messaging as a guarantee problem, not just a transport problem.
Want the full version?
The full breakdown covers receipts, sync cursors, multi-device support, session routing, ordering, retries, and how to defend delivery tradeoffs cleanly in an interview.