addEventListener method to subscribe to call events for the call lifecycle, participants, media state, and real-time updates.
addEventListener
For more granular control, useCometChatCalls.addEventListener() to subscribe to specific events:
Session Status Events
Media Events
Participant Events
Button Click Events
Layout Events
Participant Object
The participant object contains:Complete Example
Events on a prepared session
CometChatCalls.getActiveSession() returns the session as soon as it is prepared — which is what initiateCall does on the caller and what the Push SDK’s ring does on the callee — before anyone has joined. Listening on it is what lets a caller show “Ringing…” and detect the answer without joining first.
Incoming call events
On React Native these come from the Push Notifications SDK, not the Calls SDK. They report a call for the logged-in user starting and ending, whether it arrived by push while the app was killed or while it was running.
Each returns an unsubscribe function. Subscribing late is safe: a call answered before your component mounted is held and delivered to the first subscriber. See Ringing.
Login events
CometChatCalls.addLoginListener reports the Calls SDK login state. The Push SDK uses it to keep the identity its ring gates read in step with the logged-in user; your app can use it to gate call UI.
Listener ids are keys: registering the same id twice replaces the earlier listener. Remove it when the screen goes away. The
User the Calls SDK hands back is a plain object with a uid field, not a class with getUid().Related Documentation
- Ringing - Start, answer and end calls
- Actions - Control the call programmatically
- Session Settings - Configure event listeners
- Participant Management - Manage participants