Skip to main content
  • User delegate: CometChat.userdelegate = self (conform to CometChatUserDelegate) — onUserOnline(user:), onUserOffline(user:)
  • Group delegate: CometChat.groupdelegate = self (conform to CometChatGroupDelegate) — member joined/left/kicked/banned events
  • Message delegate: CometChat.messagedelegate = self (conform to CometChatMessageDelegate) — message received/edited/deleted/reaction events
  • Call delegate: CometChat.calldelegate = self (conform to CometChatCallDelegate) — incoming/outgoing call events
  • Login delegate: CometChat.addLoginListener(_:_:) (conform to CometChatLoginDelegate) — login/logout success/failure events
  • Connection delegate: CometChat.addConnectionListener(_:_:) (conform to CometChatConnectionDelegate) — connection status events
  • AI Assistant delegate: CometChat.addAIAssistantListener(_:_:) (conform to AIAssistantEventsDelegate) — AI events
  • Related: User Presence · Receive Message · Ringing
CometChat provides 4 listeners (Delegates) viz.
  1. User Delegate (Listener)
  2. Group Delegate (Listener)
  3. Message Delegate (Listener)
  4. Call Delegate (Listener)

User Delegate Methods

The CometChat 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:
Do not forget to set your view controller as a CometChat delegate probably in viewDidLoad() as CometChat.userdelegate = self

Group Delegate Methods

The CometChatGroupDelegate 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:
Do not forget to set your view controller as a CometChat delegate probably in viewDidLoad() as CometChat.groupdelegate = self

Message Delegate Methods

The CometChatMessageDelegate 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:
Do not forget to set your view controller as a CometChat delegate probably in viewDidLoad() as CometChat.messagedelegate = self

Call Delegate Methods

The CometChatCallDelegate 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:
Do not forget to set your view controller as a CometChat delegate probably in viewDidLoad() as CometChat.calldelegate = self

Login Delegate Methods

The CometChatLoginDelegate 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:
To add the login listener:
To remove the login listener:

Connection Delegate Methods

The CometChatConnectionDelegate 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:
To add the connection listener:
To remove the connection listener:

AI Assistant Events Delegate

The AIAssistantEventsDelegate 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:
To add the AI Assistant listener:
To remove the AI Assistant listener:


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