Skip to main content
CometChat provides the following listeners. With offline support enabled, four more listeners report what the SDK does on the device; see Offline listeners.
  1. User Listener
  2. Group Listener
  3. Message Listener
  4. Conversation Listener
  5. Call Listener
  6. AI Assistant Listener
  7. 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. With offline support enabled, MessageListener also receives onMessagesSynced after the SDK catches up on reconnect. It 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. See Stay in Sync. To add the MessageListener, you need to use the addMessageListener() method provided by the CometChat class.
Remove the listener when no longer needed:

Conversation Listener

Receive events when a conversation is pinned or unpinned. This is a separate channel from MessageListener because its payload is a Conversation, not a message.
Remove the listener once you are done:
See Pin A Conversation for the full feature.

Call Listener

Ringing now runs on the Calls SDK. The Chat SDK’s calling methods (CometChat.initiateCall, acceptCall, rejectCall, endCall) are superseded by CometChatCalls.initiateCall, connect, session.join(container) and endCall(sessionId, status) in the Calls SDK 5.1. The CallListener stays in use on the web: it is how an incoming call reaches an open tab (onIncomingCallReceived, onIncomingCallCancelled) and how the caller learns why a ring ended (onOutgoingCallRejected). The caller’s “answered” event is the Calls SDK’s onParticipantJoined on the prepared session; a decline, busy or no answer still reaches the caller as onOutgoingCallRejected. See Ringing and Migrating from Legacy Ringing.
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:

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 passed to CallSettingsBuilder.setCallListener().
This is the v4 listener, which Calls SDK v5 keeps for compatibility. In v5, subscribe to session events with CometChatCalls.addEventListener(); it also delivers the events v4 does not have. See Events.
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:

Offline Listeners

With offline support enabled, these 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

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