Quick Reference for AI Agents & Developers
- Start typing:
CometChat.startTyping(indicator:)— passTypingIndicator(receiverID:receiverType:) - End typing:
CometChat.endTyping(indicator:) - Listen for typing:
onTypingStarted(_:),onTypingEnded(_:)in message listener delegate - Receiver types:
.user,.group - Related: Send Message · Receive Message · Messaging Overview
Key Characteristics
| Characteristic | Description |
|---|---|
| Fire-and-forget | No success/failure callbacks |
| Transient | Not persisted, receiver must be online |
| Real-time only | No history or missed events |
| Supports metadata | Can send custom data with indicator |
Send a Typing Indicator
In other words, as a sender, how do I let the recipient(s) know that I’m typing?Start Typing (User)
- Swift
- Objective C
Sample Payloads - Start Typing (User)
Sample Payloads - Start Typing (User)
- Request
- Sent
Method:
CometChat.startTyping(indicator:)| Parameter | Type | Value |
|---|---|---|
| receiverID | String | "cometchat-uid-2" |
| receiverType | CometChat.ReceiverType | .user |
| metadata | [String: Any]? | nil |
Start Typing (Group)
- Swift
Sample Payloads - Start Typing (Group)
Sample Payloads - Start Typing (Group)
- Request
- Sent
Method:
CometChat.startTyping(indicator:)| Parameter | Type | Value |
|---|---|---|
| receiverID | String | "group-guid-1" |
| receiverType | CometChat.ReceiverType | .group |
| metadata | [String: Any]? | nil |
Start Typing with Metadata
- Swift
Sample Payloads - Start Typing with Metadata
Sample Payloads - Start Typing with Metadata
- Request
- Sent
Method:
CometChat.startTyping(indicator:)| Parameter | Type | Value |
|---|---|---|
| receiverID | String | "cometchat-uid-2" |
| receiverType | CometChat.ReceiverType | .user |
| metadata | [String: Any] | ["isVoiceTyping": true, "language": "en"] |
You can use the
metadata field of the TypingIndicator class to pass additional data along with the typing indicators. This data will be received at the receiver end and can be obtained using the metadata property.End Typing (User)
- Swift
- Objective C
Sample Payloads - End Typing (User)
Sample Payloads - End Typing (User)
- Request
- Sent
Method:
CometChat.endTyping(indicator:)| Parameter | Type | Value |
|---|---|---|
| receiverID | String | "cometchat-uid-2" |
| receiverType | CometChat.ReceiverType | .user |
End Typing (Group)
- Swift
Sample Payloads - End Typing (Group)
Sample Payloads - End Typing (Group)
- Request
- Sent
Method:
CometChat.endTyping(indicator:)| Parameter | Type | Value |
|---|---|---|
| receiverID | String | "group-guid-1" |
| receiverType | CometChat.ReceiverType | .group |
Real-time Typing Indicators
In other words, as a recipient, how do I know when someone is typing? To receive typing indicators, implementCometChatMessageDelegate:
- Swift
- Objective C
Sample Payloads - Receive Typing Started
Sample Payloads - Receive Typing Started
- Delegate Payload
Method:
onTypingStarted(_ typingDetails: TypingIndicator)TypingIndicator Object:| Parameter | Type | Value |
|---|---|---|
| sender.uid | String | "cometchat-uid-1" |
| sender.name | String | "John Doe" |
| sender.avatar | String | "https://example.com/avatar.png" |
| receiverID | String | "cometchat-uid-2" |
| receiverType | ReceiverType | .user |
| metadata | [String: Any]? | nil |
Sample Payloads - Receive Typing Ended
Sample Payloads - Receive Typing Ended
- Delegate Payload
Method:
onTypingEnded(_ typingDetails: TypingIndicator)TypingIndicator Object:| Parameter | Type | Value |
|---|---|---|
| sender.uid | String | "cometchat-uid-1" |
| sender.name | String | "John Doe" |
| receiverID | String | "cometchat-uid-2" |
| receiverType | ReceiverType | .user |
TypingIndicator Object Properties
| Property | Type | Description |
|---|---|---|
sender | User? | User object of the person typing |
receiverID | String | UID of user or GUID of group |
receiverType | ReceiverType | .user or .group |
metadata | [String: Any]? | Custom data sent with indicator |
Receiver Types
| Type | Value | Description |
|---|---|---|
| User | .user | One-on-one conversation |
| Group | .group | Group conversation |
Delegate Methods
| Method | Description |
|---|---|
onTypingStarted(_:) | Called when user starts typing |
onTypingEnded(_:) | Called when user stops typing |
Typing indicators are transient and not persisted. The receiver must be online to receive them.