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.
AI Integration Quick Reference
AI Integration Quick Reference
- User delegate:
CometChat.userdelegate = self(conform toCometChatUserDelegate) —onUserOnline(user:),onUserOffline(user:) - Group delegate:
CometChat.groupdelegate = self(conform toCometChatGroupDelegate) — member joined/left/kicked/banned events - Message delegate:
CometChat.messagedelegate = self(conform toCometChatMessageDelegate) — message received/edited/deleted/reaction events - Call delegate:
CometChat.calldelegate = self(conform toCometChatCallDelegate) — incoming/outgoing call events - Login delegate:
CometChat.addLoginListener(_:_:)(conform toCometChatLoginDelegate) — login/logout success/failure events - Connection delegate:
CometChat.addConnectionListener(_:_:)(conform toCometChatConnectionDelegate) — connection status events - AI Assistant delegate:
CometChat.addAIAssistantListener(_:_:)(conform toAIAssistantEventsDelegate) — AI events - Related: User Presence · Receive Message · Ringing
- User Delegate (Listener)
- Group Delegate (Listener)
- Message Delegate (Listener)
- Call Delegate (Listener)
User Delegate Methods
TheCometChat provides you with live events related to users. Below are the callback methods provided by the CometChatUserDelegate.
| Delegate Method | Information |
|---|---|
onUserOnline(user: User) | This method is triggered when a user comes online and is available to chat. The details of the user can be obtained from the user object received as the method parameter. |
onUserOffline(user: User) | This method is triggered when a user goes offline. The details of the user can be obtained from the User object received as the parameter. |
CometChatUserDelegate as Shown Below:
- Swift
- Objective C
Group Delegate Methods
TheCometChatGroupDelegate provides you with all the real-time events related to groups. Below are the callback methods provided by the CometChatGroupDelegate.
| Method | Information |
|---|---|
onGroupMemberJoined(action: Action, joinedUser: User, joinedGroup: Group) | This method is triggered when a user joins any group. All the members present in the group will receive this event. |
onGroupMemberLeft(action: Action, leftUser: User, leftGroup: Group) | This method is triggered when a user who was a member of any group leaves the group. All the members of the group receive this event. |
onGroupMemberKicked(action: Action, kickedUser: User, kickedBy: User, kickedFrom: Group) | This method is triggered when a user is kicked from a group. All the members including the user receive this event |
onGroupMemberBanned(action: Action, bannedUser: User, bannedBy: User, bannedFrom: Group) | This method is triggered when a user is banned from a group. All the members including the user receive this event |
onGroupMemberUnbanned(action: Action, unbannedUser: User, unbannedBy: User, unbannedFrom: Group) | This method is triggered when a user is banned from a group. All the members of the group receive this event. |
onGroupMemberScopeChanged(action: Action, updatedBy: User, updatedUser: User, scopeChangedTo: String, scopeChangedFrom: String, group: Group) | This method is triggered when the scope of any Group Member has been changed. All the members that are a part of that group receive this event |
onMemberAddedToGroup(action: Action, addedby: User, userAdded: User, addedTo: Group) | This method is triggered when a user is added to any group. All the members including the user himself receive this event. |
CometChatGroupDelegate as shown below:
- Swift
- Objective C
Message Delegate Methods
TheCometChatMessageDelegate provides you with live events related to messages. Below are the callback methods provided by the CometChatMessageDelegate.
| Method | Information |
|---|---|
onTextMessageReceived(textMessage: TextMessage) | This event is triggered when a Text Message is received. |
onMediaMessageReceived(mediaMessage: MediaMessage) | This event is triggered when a Media Message is received. |
onCustomMessageReceived(customMessage: CustomMessage) | This event is triggered when a Custom Message is received. |
onTypingStarted(_ typingDetails: TypingIndicator) | This event is triggered when a user starts typing in a user/group conversation. |
onTypingEnded(_ typingDetails: TypingIndicator) | This event is triggered when a user stops typing in a user/group conversation. |
onTransisentMessageReceived(_ message: TransientMessage) | This event is triggered when a transient message is received. |
onMessagesDelivered(receipt: MessageReceipt) | This event is triggered when a set of messages are marked as delivered for any particular conversation. |
onMessagesRead(receipt: MessageReceipt) | This event is triggered when a set of messages are marked as read for any particular conversation. |
onMessagesDeliveredToAll(receipt: MessageReceipt) | This event is triggered when messages are delivered to all participants in a group. |
onMessagesReadByAll(receipt: MessageReceipt) | This event is triggered when messages are read by all participants in a group. |
onMessageEdited(message: BaseMessage) | This method is triggered when a particular message has been edited in a user/group conversation. |
onMessageDeleted(message: BaseMessage) | This event is triggered when a particular message is deleted in a user/group conversation. |
| onInteractiveMessageReceived(interactiveMessage: InteractiveMessage) | This event is triggered when an Interactive Message is received. |
| onInteractionGoalCompleted(_ receipt: InteractionReceipt) | This event is triggered when an interaction Goal is achieved. |
| onMessageReactionAdded(reactionEvent: ReactionEvent) | This event is triggered when a reaction is added to a message. |
| onMessageReactionRemoved(reactionEvent: ReactionEvent) | This event is triggered when a reaction is removed from a message. |
onMessageModerated(_ message: BaseMessage) | This event is triggered when a message is moderated. |
| onAIAssistantMessageReceived(_ message: AIAssistantMessage) | This event is triggered when an AI Assistant message is received. |
| onAIToolResultMessageReceived(_ message: AIToolResultMessage) | This event is triggered when an AI Tool result message is received. |
| onAIToolArgumentsMessageReceived(_ message: AIToolArgumentMessage) | This event is triggered when an AI Tool arguments message is received. |
CometChatMessageDelegate as shown below:
- Swift
Call Delegate Methods
TheCometChatCallDelegate provides you with live events related to calls. Below are the callback methods provided by the CometChatCallDelegate.
| Method | Information |
|---|---|
onIncomingCallReceived(incomingCall: Call?, error: CometChatException?) | This event is triggered when the logged-in user receives an incoming call. The details of the call can be obtained from the Call object received as the method parameter. |
onOutgoingCallAccepted(acceptedCall: Call?, error: CometChatException?) | This event is triggered when the call initiated by the logged-in user is accepted by the recipient. The details of the call can be obtained from the Call object received as the method parameter. |
onOutgoingCallRejected(rejectedCall: Call?, error: CometChatException?) | This event is triggered when the call initiated by the logged-in user is rejected by the recipient. The details of the call can be obtained from the Call object received as the method parameter |
onIncomingCallCancelled(canceledCall: Call?, error: CometChatException?) | This event is triggered when an incoming call is canceled by the initiator of the call. The details of the call can be obtained from the Call object received as the method parameter |
onCallEndedMessageReceived(endedCall: Call?, error: CometChatException?) | This event is triggered when a call ended message is received. The details of the call can be obtained from the Call object received as the method parameter |
call events, you must add protocol conformance CometChatCallDelegate as shown below:
- Swift
- Objective C
Login Delegate Methods
TheCometChatLoginDelegate provides you with live events related to login and logout. Below are the callback methods provided by the CometChatLoginDelegate.
| Method | Information |
|---|---|
onLoginSuccess(user: User) | This event is triggered when a user successfully logs in. |
onLoginFailed(error: CometChatException?) | This event is triggered when a login attempt fails. |
| onLogoutSuccess() | This event is triggered when a user successfully logs out. |
onLogoutFailed(error: CometChatException?) | This event is triggered when a logout attempt fails. |
CometChatLoginDelegate as shown below:
- Swift
Connection Delegate Methods
TheCometChatConnectionDelegate provides you with live events related to the WebSocket connection status. Below are the callback methods provided by the CometChatConnectionDelegate.
| Method | Information |
|---|---|
| connecting() | This event is triggered when the SDK is attempting to establish a connection. |
| connected() | This event is triggered when the SDK successfully establishes a connection. |
| disconnected() | This event is triggered when the SDK disconnects from the server. |
| onfeatureThrottled() | This event is triggered when a feature is throttled due to rate limiting. |
onConnectionError(error: CometChatException) | This event is triggered when there is an error in the connection. |
CometChatConnectionDelegate as shown below:
- Swift
AI Assistant Events Delegate
TheAIAssistantEventsDelegate provides you with live events related to AI Assistant features. Below are the callback methods provided by the AIAssistantEventsDelegate.
| Method | Information |
|---|---|
| onAIAssistantEventReceived(_ event: AIAssistantBaseEvent) | This event is triggered when an AI Assistant event is received. |
AIAssistantEventsDelegate as shown below:
- Swift
Next Steps
User Presence
Monitor user online/offline status
Receive Messages
Handle incoming messages in real time
Connection Status
Monitor the SDK connection state
Login Listeners
Listen for login and logout events