Callback listeners
Add all following callback methods while initializing the SDK. Callback listeners are functions that will be called whenever the specified event happens.
Example Request#
Note: Callback Listener name should be the same as described below.
Connection Listener#
Handles Connection Status, triggered whenever connection status changes.
Sample Response:
Possible Status:
| Status | Description |
|---|---|
CONNECTED | Connection Established |
DISCONNECTED | Disconnected |
CONNECTIONFAILED | Connection Failed |
Presence Listener#
Handles Presence Status of Friends, triggered whenever users online/offline status changes.
Sample Response:
User Profile Listener#
Handles User Profile Stanzas, used to get the profile detail of the user. Triggered when Get User Profile method called. Receives object values.
Sample Response:
Message Listener#
Handles Message Stanzas, triggered whenever new message related events are received in single/group chat.
Sample Response:
Receive Message#
Handles when new message received.
Message status will be updated only if all the participants sent the delivery/seen status.
Acknowledgement#
An acknowledgement will be sent from the server whenever you sent a message stanzas to the server. For example, when you sent a delivery status to the message that you received, you will get an acknowledgment from the same.
Sample Response:
Delivered Status#
Handles delivery status received from receipient user.
Seen Status#
Handles seen status received from receipient user.
Deleted Message#
Received when message is delete (Delete For Me).
Received when message is delete (Delete For Everyone).
Clear/Delete Chat#
Received when clear/delete chat method is called.
Clear/Delete All Chat#
Received when clear all/delete all chat method is called.
Super Admin Delete Group Chat#
Received when a super admin deletes a group chat.
Logout#
When user tries to log in with another device using same credentials, then the 1st user receives logout message. (In order to logout the user).
Group Created#
Received when group created.
User Added#
Received when user added.
User Removed#
Received when user removed.
User Updated Profile#
Received when user updated the group profile.
User Admin#
Received when user admin.
Admin access revoked#
Received when admin access revoked.
User Left#
Received when user left.
Note: To handle notification types in UI click here
User blocked me#
Received when user blocked you with their userId.
User unblocked me#
Received when user unblocked you with their userId.
Media Upload Listener#
Handles Media Message upload progress, triggered when media message is sent. Receives an object values.
Also handles the cancel request. Whenever you would like to cancel upload of a media message, you can use source.cancel() method to cancel the media content upload. Each cancel source is unique mapped to message id.
Sample Response:
Media Download Listener#
Handles Media Message download progress triggered when media message in download. Receives an Object values.
Sample Response:
Single Message Data Listener#
Handles User Block/Unblock Status, when user connected with 2 resource if one of the resource blocking/unblocking the user, other resource will be notified with this event.
Sample Response:
Group Profile Listener#
Handles Group Profile Listener, triggered when group activities are requested/updated.
New Group Created#
When a new group is created and a user is added as a participant, triggering the groupProfileListener callback, it also responds to the addition of users with the userAdded
New Participant Added#
Whenever new participant is added to group, groupProfileListener callback will be triggered and the following response will be received.
Sample Response:
Admin access revoked#
When a group member's admin access is revoked, this callback will be triggered.
Group Profile Updated#
Handles Group Profile Data Stanzas, triggered when Set Group Profile method called or new group created. Receives an object values.
Sample Response:
Participant Removed#
Whenever new participant is removed from group, groupProfileListener callback will be triggered and the following response will be received.
Same response will be handled for Exit Group method as well.
Sample Response:
Mute Chat Listener#
Handles Chat Mute Status, triggered when the particular single chat is muted/unmuted.
Sample Response: