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 (superseded):
CometChat.calldelegate = self(conform toCometChatCallDelegate) — legacy incoming/outgoing call events; new apps use the Calls SDK’sCometChatCalls.addIncomingCallListener(Ringing) - 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.
In order to use the Delegate methods you must add protocol conformance
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.
You can receive live events related to groups. In order to receive group events, you must add protocol conformance
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.
In order to receive incoming messages, you must add protocol conformance
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.
In order to receive all
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.
In order to receive login/logout events, you must add protocol conformance
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.
In order to receive connection events, you must add protocol conformance
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.
In order to receive AI Assistant events, you must add protocol conformance
AIAssistantEventsDelegate as shown below:
- Swift
Offline listeners
With offline support enabled (SDK 4.2.0 or later),CometChatMessageDelegate also receives onMessagesSynced(_:). It fires after the SDK catches up on reconnect and carries updates to already-cached messages that changed while offline: reactions, edits, deletes and receipts. Messages that arrived while offline still come through the typed callbacks such as onTextMessageReceived.
Four more listeners report what the SDK does on the device rather than events from the server. Each is documented with examples on its own page.
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