How WhatsApp Shows “Typing…” in Real Time

Persistent connections, ephemeral events and global scale: how WhatsApp delivers the typing indicator without polling, database writes or history.

Dhananjay Aggarwal, · 5 min read
Share
Summarize with AI
Two phones showing Typing… connected through MQTT to WhatsApp servers, under the heading Inside WhatsApp’s Real-Time Typing System.

If you’ve ever noticed how WhatsApp shows “Typing…” the moment the other person starts typing, even on slow or flaky networks, you’ve already seen a well-engineered real-time presence system at work.

What looks like a tiny UI feature is backed by:

  • Always-on socket connections
  • Event-driven messaging
  • Ephemeral, non-persistent data flow
  • Infrastructure built to handle millions of concurrent users

This article breaks down exactly how it works, from client to server, without hand-wavy explanations.

The Core Idea#

“Typing…” is not a stored state. It is a real-time signal, streamed over persistent connections, delivered instantly and discarded immediately.

No polling. No database writes. No history.

1. Persistent Connections, Not HTTP Requests#

When you open WhatsApp, the app opens a long-lived TCP socket connection to WhatsApp’s backend servers.

Instead of traditional HTTP APIs, WhatsApp relies on MQTT (Message Queuing Telemetry Transport).

Why MQTT?

  • Designed for low bandwidth and unstable networks
  • Minimal packet overhead
  • Supports bidirectional, server-push communication
  • Ideal for mobile devices that frequently switch networks

Once this connection is established, it stays alive for the whole session. The server can push events to the client instantly, without waiting for a request.

A WhatsApp client holding a persistent MQTT connection to the backend: an MQTT broker, a chat server and a presence server.

2. Typing Is an Event, Not a Status#

When a user starts typing, WhatsApp does not:

  • Update a database row
  • Flip a “typing = true” flag
  • Store anything durable

Instead, the client emits a lightweight event over the existing socket.

Conceptually, it looks like this:

code
EVENT: USER_TYPING
chat_id: X
sender_id: Y

This event goes to the backend immediately.

The server then:

  1. Identifies the active participants in the chat
  2. Checks which recipients have live socket connections
  3. Pushes the event to those sockets
  4. Discards the event after delivery

The receiver’s UI listens for this event and renders “Typing…” in real time.

The sender's phone emits a USER_TYPING event with chat_id and sender_id to the MQTT broker, which pushes it to the receiver's phone, where the UI shows Typing…

3. Why Typing Indicators Are Ephemeral#

Typing events are intentionally non-persistent.

They:

  • Are never written to databases
  • Exist only in memory
  • Expire immediately after transmission

If the sender:

  • Stops typing
  • Loses connectivity
  • Closes or backgrounds the app

The event stream stops. The receiver gets nothing further, so the UI clears the indicator.

This design prevents:

  • Stale presence signals
  • Unnecessary storage load
  • Complex cleanup logic

Ephemerality is a feature, not a limitation.

4. No Polling, No Refresh Cycles#

A key reason WhatsApp feels instant is that it never polls for typing updates.

Polling would mean:

  • Repeated API calls
  • Higher latency
  • Massive backend load at scale

Instead:

  • Every client stays connected
  • The server pushes events as they happen
  • The UI reacts only to incoming messages

This event-driven model is both faster and cheaper at global scale.

Side by side: polling sends frequent network requests to the server with higher latency, while a persistent socket keeps one open connection with low latency.

5. Scaling to Millions of Concurrent Typers#

At any moment, millions of users across India, Brazil, Europe and beyond are typing at the same time.

WhatsApp handles this with:

  • Highly concurrent Erlang-based backend systems
  • Horizontal sharding of connection-handling nodes
  • Stateless routing for ephemeral events
  • Regional load balancers to minimize latency

Each backend node can hold millions of open socket connections efficiently.

Because typing events are:

  • Extremely small
  • Short-lived
  • Never stored

They scale linearly without becoming a bottleneck.

6. Why This Architecture Works So Well#

The strength of this system lies in what it doesn’t do.

  • No database writes for presence
  • No retries for lost typing events
  • No synchronization guarantees

Typing indicators are best-effort signals, not critical data. If one event is missed, the system simply moves on.

This keeps latency low and infrastructure simple.

The Key Takeaway#

“Typing…” is not magic. It is not a complex backend workflow.

It is:

  • A tiny real-time event
  • Sent over an always-on socket
  • Delivered instantly
  • Discarded immediately

This is a textbook example of event-driven system design done right.

Pairs of clients on both sides connected over persistent connections to MQTT backend servers with chat and presence services.

Final Thought#

Small UI features often reveal the best system design lessons.

WhatsApp’s typing indicator shows how:

  • Ephemeral data should stay ephemeral
  • Persistent connections beat polling at scale
  • Real-time systems don’t need heavy persistence

If you’re designing chat apps, collaboration tools, multiplayer games or live dashboards, this pattern is worth studying closely.

Filed under real-time, websockets, messaging

Was this post useful?
Share
Summarize with AI
Prefer IntervueClub on GoogleShow our posts more often in Top Stories

Written by Dhananjay Aggarwal

Shard by user or by time? Work it out with the write rateOct 4, 2026 · 4 min readEstimating QPS from daily users in three stepsSep 28, 2026 · 2 min read

All posts