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 |
CONNECTIONTIMEOUT | Connection Timeout |
CONNECTIONFAILED | Connection Failed |
AUTHENTICATIONFAILED | Authentication Failed |
ERROROCCURED | Error |
Presence Listener#
Handles Presence Status of Friends, triggered whenever users online/offline status changes.
Sample Response:
FriendsList Listener#
Handles Friends List (Contacts) Stanzas, triggered when Get Friends method called. Receives an array of object values.
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.
Receive Message#
Handles when new message received.
Sample Response for Single Chat:
Sample Response for Group Chat:
For group, 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.
Typing/Gone Status#
Received when user starts/stops typing text message.
Sample Response:
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.
Delete Group Chat#
Received when delete group method is called.
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).
Note: This is applicable for Same resource (Web) only. User can log in simultaneously with Web and Mobile.
Carbon Messages#
When user is connected to more than one device, Mobile and Web resources. In order to keep all messages upto date, carbon messsages are used. If the target user is online with multiple resources when the original message is sent, the device with highest priority receives the message and sends a carbon message to other resources. By default carbon will be enabled when SDK is initialized
Carbon Receive Message Sample Response:
Carbon Sent Acknowledgment Sample Response:
Carbon Typing/Gone Status Sample Response:
Carbon Delivered Sample Response:
Carbon Seen Sample Response:
Carbon Sent Message Sample Response:
Carbon Clear/Delete Message Sample Response:
Carbon Clear/Delete All Sample Response:
Carbon Delete Message Sample Response: (Delete For Me)
Carbon Delete Message Sample Response: (Delete For Everyone)
Carbon Group Delete Sample Response:
Carbon SentSeen Sample Response:
Carbon SentRecall Sample Response:
Reply Message Listener#
Handles Reply Message IQs, triggered when Get Reply Message method called. Receives an array of object values.
Sample Response:
Favourite Message Listener#
Handles Favourites Message lists, triggered when favourites status updated. Receives an array of object values.
Sample Response:
Group Profile Listener#
Handles Group Profile Listener, triggered when group activities are requested/updated.
Group Message Info Listener#
Handles Group Msg Info Listener, triggered when get group message info method triggered.
New Participant Added#
Whenever new participant is added to group, groupProfileListener callback will be triggered and the following response will be received.
Sample Response:
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:
Make Admin#
Received when an member becomes admin of the group.
Sample Response:
Group Deleted#
Received when an user deletes the group.
Sample Response:
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:
Block User 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:
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.
Mute Chat Listener#
Handles Chat Mute Status, triggered when the particular single/group chat is muted/unmuted.
Sample Response:
Archive Chat Listener#
Handles Chat Archive Status, triggered when the particular single/group chat is archived/unarchived.
Sample Response:
User Deleted Listener#
Handles User Deleted Status, triggered when the particular user deleted his/her account.
Admin User/Group Block/Unblock Listener#
This feature is used to get the users/groups admin blocked status. So that you can check the user/group avail status and communicate them.
Sample Response:
Own User Blocked/Unblocked#
The block/unblock status of own user (Logged In) by Admin will be received, so that you can navigate the user to show stopper screen. Once user blocked by admin, they cannot use the application.
Contact User Blocked/Unblocked#
The block/unblock status of other user by Admin will be received, so that you can show the status as user not available. And you cannot send messages to the blocked users.
Group Chat Blocked/Unblocked#
The block/unblock status of group chat by Admin will be received, so that you will be notified the group profile status. So that we cannot restrict the access to the group.