Skip to main content

Documentation Index

Fetch the complete documentation index at: https://cometchat-22654f5b-docs-android-v6-beta2.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

FieldValue
Key ClassesTypingIndicator
Key MethodsCometChat.startTyping(), CometChat.endTyping()
Receiver TypesCometChatReceiverType.user, CometChatReceiverType.group
Listener EventsonTypingStarted, onTypingEnded
PrerequisitesSDK initialized, user logged in
// Start typing indicator to user
CometChat.startTyping(receiverUid: "UID", receiverType: CometChatReceiverType.user);

// Start typing indicator to group
CometChat.startTyping(receiverUid: "GUID", receiverType: CometChatReceiverType.group);

// Stop typing indicator
CometChat.endTyping(receiverUid: "UID", receiverType: CometChatReceiverType.user);

// Listen for typing indicators
CometChat.addMessageListener("listenerId", MessageListener(
  onTypingStarted: (TypingIndicator typingIndicator) { },
  onTypingEnded: (TypingIndicator typingIndicator) { },
));
Typing indicators let users know when someone is actively typing a message, creating a more engaging real-time chat experience.
Available via: SDK | REST API | UI Kits

Send a Typing Indicator

In other words, as a sender, how do I let the recipient(s) know that I’m typing?

Start Typing

Use startTyping() to notify the receiver that the logged-in user has started typing. The receiver will receive this information in the onTypingStarted() method of the MessageListener class.
CometChat.startTyping(
  receiverUid: "UID",
  receiverType: CometChatReceiverType.user,
);
startTyping() Parameters:
ParameterTypeDescriptionRequired
receiverUidStringThe UID of the user or GUID of the group to send the typing indicator toYes
receiverTypeStringThe type of the receiver — CometChatReceiverType.user or CometChatReceiverType.groupYes
startTyping() returns void — the typing indicator is sent as a fire-and-forget operation.

Stop Typing

Use endTyping() to notify the receiver that the logged-in user has stopped typing. The receiver will receive this information in the onTypingEnded() method of the MessageListener class.
CometChat.endTyping(
  receiverUid: "UID",
  receiverType: CometChatReceiverType.user,
);
endTyping() Parameters:
ParameterTypeDescriptionRequired
receiverUidStringThe UID of the user or GUID of the group to send the typing indicator toYes
receiverTypeStringThe type of the receiver — CometChatReceiverType.user or CometChatReceiverType.groupYes
endTyping() returns void — the typing indicator is sent as a fire-and-forget operation.
Use the metadata field of the TypingIndicator class to pass additional custom data along with the typing indicators. The metadata field is a Map<String, String> and can be set using the .metadata property. This data will be received at the receiver end and can be obtained using the same property.

Real-time Typing Indicators

In other words, as a recipient, how do I know when someone is typing? Use onTypingStarted and onTypingEnded in MessageListener to receive TypingIndicator events.
Always remove listeners when they’re no longer needed (e.g., in the dispose() method). Failing to remove listeners can cause memory leaks and duplicate event handling.
CometChat.removeMessageListener("listenerId");
class Class_Name  with MessageListener {

//CometChat.addMessageListener("listenerId", this);
@override
void onTypingStarted(TypingIndicator typingIndicator) {
  // TODO: implement onTypingStarted
}

@override
void onTypingEnded(TypingIndicator typingIndicator) {
  // TODO: implement onTypingEnded
}


}
The received object is a TypingIndicator with the following fields:
ParameterTypeDescription
senderUserAn object of the User class holding all the information related to the sender of the typing indicator.
receiverIdStringUID of the receiver. This is the ID of the group or the user the typing indicator is being sent to.
receiverTypeStringIndicates if the typing indicator is to a user or a group — CometChatReceiverType.user or CometChatReceiverType.group.
metadataMap<String, String>?Optional metadata to provide additional data.
lastTimestampDateTimeThe timestamp of the last typing indicator event.

Next Steps

Delivery & Read Receipts

Track message delivery and read status

Transient Messages

Send ephemeral real-time messages like live reactions