Skip to main content
Quick Reference
CometChat provides 4 listeners viz.
  1. User Listener
  2. Group Listener
  3. Message Listener
  4. Call Listener
Always remove all listeners when the component unmounts to prevent memory leaks. Ensure each listener has a unique ID — using duplicate IDs can lead to unexpected behavior and loss of events.

User Listener

The UserListener class provides you with live events related to users. Below are the callback methods provided by the UserListener class. To add the UserListener, you need to use the addUserListener() method provided by the CometChat class.
where UNIQUE_LISTENER_ID is the unique identifier for the listener. Please make sure that no two listeners are added with the same listener id as this could lead to unexpected behavior resulting in loss of events. Once the UserListener is not in use, you need to remove the listener using the removeUserListener() method which takes the id of the listener to be removed as the parameter.

Group Listener

The GroupListener class provides you with all the real-time events related to groups. Below are the callback methods provided by the GroupListener class. To add the GroupListener, you need to use the addGroupListener() method provided by the CometChat class.
where UNIQUE_LISTENER_ID is the unique identifier for the listener. Please make sure that no two listeners are added with the same listener id as this could lead to unexpected behavior resulting in loss of events. Once the GroupListener is not in use, you need to remove the listener using the removeGroupListener() method which takes the id of the listener to be removed as the parameter.

Message Listener

The MessageListener class provides you with live events related to messages. Below are the callback methods provided by the MessageListener class. To add the MessageListener, you need to use the addMessageListener() method provided by the CometChat class.
where UNIQUE_LISTENER_ID is the unique identifier for the listener. Please make sure that no two listeners are added with the same listener id as this could lead to unexpected behavior resulting in loss of events. Once the MessageListener is not in use, you need to remove the listener using the removeMessageListener() method which takes the id of the listener to be removed as the parameter.

Call Listener

The CallListener class provides you with live events related to calls. Below are the callback methods provided by the CallListener class. To add the CallListener, you need to use the addCallListener() method provided by the CometChat class.
where UNIQUE_LISTENER_ID is the unique identifier for the listener. Please make sure that no two listeners are added with the same listener id as this could lead to unexpected behavior resulting in loss of events. Once the CallListener is not in use, you need to remove the listener using the removeCallListener() method which takes the id of the listener to be removed as the parameter.
  • Register listeners as early as possible in your app lifecycle (e.g., after successful login) to avoid missing events
  • Use unique, descriptive listener IDs (e.g., "CHAT_SCREEN_MESSAGE_LISTENER") to make debugging easier
  • Always remove listeners when the component unmounts or the user logs out
  • Avoid registering the same listener ID multiple times — this overwrites the previous listener silently
  • For React Native, use useEffect cleanup functions to handle listener removal automatically
  • Events not firing: Ensure the listener is registered with a unique ID and that you’re handling the correct callback method for the event type.
  • Duplicate events: Check that you’re not registering the same listener multiple times without removing the previous one first.
  • Events stop after navigation: If you remove listeners on screen unmount, re-register them when the screen mounts again.
  • Missing group events: Group listeners only fire for groups the logged-in user is a member of. Verify group membership.
  • Call events not received: Ensure the CometChat Calling SDK is properly initialized alongside the Chat SDK.

Next Steps

User Presence

Track when users come online or go offline

Receive Messages

Handle incoming messages in real time

Typing Indicators

Show when users are typing

Default Call

Implement voice and video calling