User Listener
TheUserListener 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.
- JavaScript
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.
- JavaScript
Group Listener
TheGroupListener 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.
- JavaScript
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.
- JavaScript
Message Listener
TheMessageListener 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.
- JavaScript
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.