A typing indicator shows "Alice is typing…" while someone writes a message. It makes a chat feel live, and tells a support customer that the agent is working on a reply.
Where this fits: your app is connected to a conversation (see the
Chat quickstart). The sender's app sends "started" and
"stopped" signals; everyone else's app gets a typing event.
Use it
In your app:
await chat.startTyping();
await chat.stopTyping();
chat.on('typing', (event) => {
console.log(`${event.userId} ${event.isTyping ? 'started' : 'stopped'} typing`);
});const { typingUsers, onInput } = useTyping();
// <input onChange={onInput} /> — call on every keystrokeCall onInput() on every keystroke. It sends at most one signal per second,
and stops on its own after a pause. You don't call startTyping() or
stopTyping() yourself.
await livqeno.chat!.startTyping();
await livqeno.chat!.stopTyping();await chat.startTyping();
await chat.stopTyping();
chat.typing.listen((event) {
print('${event.userId} ${event.isTyping ? "started" : "stopped"} typing');
});A typical pattern (without React):
- Call
startTyping()from the input's change handler. It's safe to call on every keystroke. - Call
stopTyping()when the user sends the message or clears the input. - On the receiving side, keep a list of who's typing from
typingevents, and show "Alice is typing…" or "2 people are typing…".
Never saved
Typing signals are never saved to the database. They expire after 7 seconds. Nobody needs to know who was typing yesterday.
No stuck "is typing…"
A common bug is "Alice is typing…" that never goes away, because her app crashed before sending "stop". Livqeno has three protections:
- Server: the typing signal expires after 7 seconds, no matter what.
- Sender's SDK:
@livqeno/chatstops typing on its own after a pause. - Receiver's SDK:
@livqeno/reacthides a typing user after 8 seconds, even if "stop" was lost.
You never get your own typing event back, so you don't need to filter yourself out.
Common mistakes
| Mistake | What you'll see | Fix |
|---|---|---|
Not calling stopTyping() after sending | "Alice is typing…" lingers for a few seconds after her message arrives. | Call stopTyping() right after sendMessage(). |
| Building your own timer on the receiving side (outside React) | Indicators that never clear if "stop" is lost. | Hide a typing user after about 8 seconds without a new signal. |