Issue Description
Developers often want to display a “User is typing…” indicator within a chat application built using Agora Chat SDK. This feature visually informs participants when another user is actively typing a message, enhancing the real-time chat experience.
At present, the Agora Chat SDK does not include a built-in typing indicator feature. However, developers can implement this functionality manually using custom command (CMD) messages.
Platform/SDK
Agora Chat SDK (Web, Android, iOS, Unity)
Error Message
(Not applicable — this is a feature implementation request.)
Step-by-Step Solution
-
Detect when a user starts typing
In your chat input component, add an event listener that triggers whenever the user begins typing.
-
Send a CMD message to indicate typing activity
When typing starts, send a CMD message with a custom action field (e.g.,
"typing").-
Sample (Web SDK):
const options = { // Set the message type. type: "cmd", // Set the chat type. chatType: "singleChat", // The username of the message receiver. to: "username", // Set the custom action. action: "typing..", // Set the extended message. ext: { extmsg: "extends messages" }, }; // Create a CMD message. const msg = AgoraChat.message.create(options); // Call send to send the CMD message. chatClient .send(msg) .then((res) => { // Occurs when the message is sent. console.log("Success"); }) .catch((e) => { // Occurs when the message fails to be sent. console.log("Fail"); });
-
Listen for CMD messages on the receiving client
On the recipient’s device, implement a listener for incoming CMD messages.
When a CMD message with
action === 'typing'is received, display a “User is typing…” indicator in the chat UI.
Root Cause
Agora Chat SDK currently does not provide a native typing indicator API. This feature must be implemented manually using CMD-type messages to broadcast typing activity between clients.
Corresponding Document/Link
Agora Chat CMD Message Reference for custom typing events to simulate real-time typing feedback in chat conversations.