WhatsApp System Design

Typing Indicator

2 min read

A typing indicator is a lightweight real-time signal that someone is composing a message.

It is not the message itself. The draft stays on the sender's device until they press Send.

The client simply emits a small event:

User is typing.


How It Works

The server forwards the event almost immediately.

No message content is transmitted.


Why Isn't It Stored?

Typing is temporary information.

Five seconds later it becomes useless.

Persisting these events would only waste storage.

Instead, the server simply forwards the event to connected recipients.


What Is Actually Sent?

Something similar to

Conversation ID

User ID

Event Type = Typing

Timestamp

Notice that your text is not included.

The other person has absolutely no idea what you're typing.


Why WebSockets?

Typing indicators must appear almost instantly.

Opening a new HTTP connection every second would be expensive.

Instead, clients maintain a persistent WebSocket connection.

This allows events to travel in a few milliseconds.


What Happens If You Stop Typing?

Most messaging platforms automatically expire typing events after a few seconds.

No explicit database cleanup is required.

The UI simply removes the typing indicator.


Interview Notes

Interviewer:

Does the server store typing events?

Answer:

Typically no.

Typing is ephemeral state.

It is forwarded immediately and automatically expires after a short timeout.


Key Takeaways

✔ Typing is an event, not a message.

✔ Message content never leaves the device until Send is pressed.

✔ WebSockets enable real-time delivery.

✔ Typing events are usually not persisted.

✔ Temporary state should remain temporary.