Design: Real-Time Chat
ADVANCED › System Design
Designing an Android chat app: real-time transport, local store, receipts, offline queue, and scale.
Real-time chat is a staple mobile system-design interview because it forces tradeoffs between latency, reliability, offline support, and battery. Interviewers probe how you pick a transport, keep a local store as source of truth, guarantee ordering and idempotent delivery, and degrade gracefully when the network or app process dies. Strong answers connect product requirements to concrete Android components (Room, Flow, WorkManager, FCM) rather than reciting backend trivia.
What this covers
- Choosing transport: persistent WebSocket for foreground vs FCM push to wake a backgrounded app
- Optimistic send with a client-generated message id and a local pending/sent/delivered/read state machine
- Message ordering and dedup: server-authoritative sequence numbers plus idempotency keys
- Offline send queue, retry with exponential backoff, and reconnection handling
- Cursor (keyset) pagination of history and a Room database as the single source of truth
- Presence/typing efficiency, push-notification strategy, and battery/Doze constraints
Study this topic
- Design: Real-Time Chat explained: the guided lesson
- 14 practice quiz questions
- 9 revision flashcards
- Design: Real-Time Chat interview questions and answers