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.

// Start typing indicator
let typing = TypingIndicator(receiverID: "UID", receiverType: .user)
CometChat.startTyping(indicator: typing)

// Stop typing indicator
CometChat.endTyping(indicator: typing)

// Listen for typing events
extension VC: CometChatMessageDelegate {
  func onTypingStarted(_ typingDetails: TypingIndicator) { }
  func onTypingEnded(_ typingDetails: TypingIndicator) { }
}

Send a Typing Indicator

Start Typing

Use startTyping() with a TypingIndicator object to notify the receiver that you’re typing.
let typingIndicator = TypingIndicator(receiverID: "cometchat-uid-2", receiverType: .user)
CometChat.startTyping(indicator: typingIndicator)
startTyping() returns void — the typing indicator is sent as a fire-and-forget operation.

Stop Typing

Use endTyping() to notify the receiver that you’ve stopped typing.
let typingIndicator = TypingIndicator(receiverID: "cometchat-uid-2", receiverType: .user)
CometChat.endTyping(indicator: typingIndicator)
endTyping() returns void — the typing indicator is sent as a fire-and-forget operation.
Use the metadata property of TypingIndicator to pass additional custom data. Retrieve it with metadata on the receiver side.

Real-time Typing Indicators

Use onTypingStarted and onTypingEnded in CometChatMessageDelegate to receive typing events.
extension YourViewController: CometChatMessageDelegate {

    func onTypingStarted(_ typingDetails: TypingIndicator) {
        print("User started typing")
        print("Sender: \(typingDetails.sender?.name ?? "")")
        print("Receiver ID: \(typingDetails.receiverID)")
        print("Receiver Type: \(typingDetails.receiverType)")
    }

    func onTypingEnded(_ typingDetails: TypingIndicator) {
        print("User stopped typing")
        print("Sender: \(typingDetails.sender?.name ?? "")")
    }
}

// Register the delegate:
CometChat.messagedelegate = self
The received TypingIndicator object contains:
PropertyTypeDescription
senderUser?User object of the person typing
receiverIDStringUID of user or GUID of group
receiverTypeReceiverType.user or .group
metadata[String: Any]?Custom data sent with indicator
Typing indicators are transient and not persisted. The receiver must be online to receive them.

Next Steps

Delivery & Read Receipts

Track when messages are delivered and read

Transient Messages

Send ephemeral real-time messages like live reactions