- User Listener
- Group Listener
- Message Listener
- Conversation Listener
- Call Listener
- AI Assistant Listener
- Ongoing Call Listener (Calls SDK)
User Listener
Receive online/offline presence events for users.
To add the
UserListener:
- TypeScript
- JavaScript
- TypeScript
- JavaScript
Group Listener
Receive events when group members join, leave, are kicked/banned, or have their scope changed.
To add the
GroupListener:
- TypeScript
- JavaScript
- TypeScript
- JavaScript
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.
- TypeScript
- JavaScript
- TypeScript
- JavaScript
Conversation Listener
Receive events when a conversation is pinned or unpinned. This is a separate channel fromMessageListener because its payload is a Conversation, not a message.
- TypeScript
- JavaScript
- TypeScript
- JavaScript
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.
To add the
CallListener:
- TypeScript
- JavaScript
- TypeScript
- JavaScript
AI Assistant Listener
TheAIAssistantListener 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.- TypeScript
- JavaScript
- TypeScript
- JavaScript
Ongoing Call Listener (Calls SDK)
TheOngoingCallListener 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.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.
- TypeScript
- JavaScript
Login Listener
Receive events when the user’s authentication state changes — login success/failure and logout success/failure.- TypeScript
- JavaScript
Connection Listener
Receive events when the WebSocket connection state changes.- TypeScript
- JavaScript
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