Skip to main content
CometChat provides 4 listeners viz.
  1. User Listener
  2. Group Listener
  3. Message Listener
  4. Call Listener
  5. AI Assistant Listener
  6. Ongoing Call Listener (Calls SDK)

User Listener

Receive online/offline presence events for users. To add the UserListener:
Remove the listener when no longer needed:

Group Listener

Receive events when group members join, leave, are kicked/banned, or have their scope changed. To add the GroupListener:
Remove the listener when no longer needed:

Message Listener

Receive events for incoming messages, typing indicators, read/delivery receipts, message edits/deletes, reactions, and moderation results. To add the MessageListener, you need to use the addMessageListener() method provided by the CometChat class.
Remove the listener when no longer needed:

Call Listener

Receive events for incoming and outgoing call state changes. To add the CallListener:
Remove the listener when no longer needed:

AI Assistant Listener

The AIAssistantListener provides real-time streaming events from AI Agent runs. These events are received as the agent processes a user’s message, before the final persisted messages arrive via the MessageListener.
Card streaming (card_start, card, card_end) is delivered through this same callback as AIAssistantCardStartedEvent, AIAssistantCardReceivedEvent, and AIAssistantCardEndedEvent. See the Card Messages guide.
To remove the listener:
typescript CometChat.removeAIAssistantListener("UNIQUE_LISTENER_ID");

Ongoing Call Listener (Calls SDK)

The OngoingCallListener provides real-time callbacks for active call session events. It is part of the CometChat Calls SDK (not the Chat SDK) and is used with CallSettingsBuilder.setCallListener() or CometChatCalls.addCallEventListener(). All three calling flows — Call Session, Standalone Calling, and Ringing — use the same OngoingCallListener.

Callbacks

Callback Parameter Shapes

user object (received by onUserJoined, onUserLeft): onUserListUpdated(userList) — receives an array of user objects with the same shape as above. onUserMuted(event): onCallSwitchedToVideo(event): onMediaDeviceListUpdated(deviceList): onRecordingStarted(event): onRecordingStopped(), onCallEnded(), onSessionTimeout(), onCallEndButtonPressed(), onScreenShareStarted(), onScreenShareStopped() — receive no arguments.

Login Listener

Receive events when the user’s authentication state changes — login success/failure and logout success/failure.
Remove the listener when no longer needed:

Connection Listener

Receive events when the WebSocket connection state changes.
Remove the listener when no longer needed:

Next Steps

Receive Messages

Handle incoming messages in real-time

Typing Indicators

Show when users are typing

User Presence

Track online/offline status of users

Connection Status

Monitor SDK connection state changes