Event Callback

Callback List

  • HMR.StateListener

Public Callback FunctionMethod Signature
voidonUpdateHummerState(State fromState, State toState)
  • HMR.TokenInvalidListener

Public Callback FunctionMethod Signature
voidonHummerTokenInvalid(TokenInvalidCode code, String desc)
voidonHummerPreviousTokenExpired()
  • ChannelStateService.ChannelStateListener

Public Callback FunctionMethod Signature
voidonUpdateChannelState(ChannelState fromState, ChannelState toState)
  • ChatRoomService.ChatRoomListener

Public Callback FunctionMethod Signature
voidonChatRoomDismissed(ChatRoom chatRoom, User member)
voidonBasicInfoChanged(ChatRoom chatRoom, Map<ChatRoomInfo.BasicInfoType, String> propInfo)
voidonRoomInfoAddedOrUpdated(ChatRoom chatRoom, User operator, Map<String, String> propInfo)

ChatRoomService.MemberListener

Public Callback FunctionMethod Signature
voidonMemberJoined(ChatRoom chatRoom, List members)
voidonMemberLeaved(ChatRoom chatRoom, List members, int type, String reason)
voidonChatRoomMemberOffline(ChatRoom chatRoom)
voidonChatRoomMemberLeave(ChatRoom chatRoom, List members)
voidonMemberCountChanged(ChatRoom chatRoom, int count)
voidonMemberKicked(ChatRoom chatRoom, User admin, List member, String reason)
voidonMemberKicked(ChatRoom chatRoom, User admin, List member, KickOff kickOff)
voidonRoleAdded(ChatRoom chatRoom, String role, NonNull User admin, User fellow)
voidonRoleRemoved(ChatRoom chatRoom, String role, User admin, User fellow)
voidonMemberMuted(ChatRoom chatRoom, User operator, Set members, String reason)
voidonMemberUnmuted(ChatRoom chatRoom, User operator, Set members, String reason)
voidonUserInfoSet(ChatRoom chatRoom, User user, Map<String, String> infoMap)
voidonUserInfoDeleted(ChatRoom chatRoom, User user, Map<String, String> infoMap)
voidonUserInfoAddedOrUpdated(ChatRoom chatRoom, User user, Map<String, String> infoMap)
  • ChatService.MessageListener

Public Callback FunctionFunction Name
voidbeforeSendingMessage( Message message)
voidafterSendingMessage(Message message)
voidbeforeReceivingMessage(Message message)
voidafterReceivingMessage(Message message)

Callback Details

HMR.StateListener

StateListener.onUpdateHummerState

void onUpdateHummerState(State fromState, State toState)

Callback of Hummer SDK status changes

Parameters
ParameterDescription
fromStatePre-change status. See details in HMR.State.
toStateCurrent status

HMR.TokenInvalidListener

TokenInvalidListener.onHummerTokenInvalid

void onHummerTokenInvalid(TokenInvalidCode code, String desc)

Notification of invalid authentication token

Note:

This callback is deprecated, use onHummerPreviousTokenExpired instead.

Parameters
ParameterDescription
codeAn invalid type. See details in HMR.TokenInvalidCode.
descInvalidation reasons

TokenInvalidListener.onHummerPreviousTokenExpired

void onHummerPreviousTokenExpired()

Notification of Token expiration, which is trrigerd only when reconnecting. After receiving the callback, you should call refreshToken(String token, HMR.Completion completion) to update the Token.


HMR.TokenInvalidCode

public enum TokenInvalidCode {
    EXPIRED(1);
}

Token invalid type

Bit operationDescription
EXPIRED(1)Expired

ChannelStateService.ChannelStateListener

ChannelStateListener.onUpdateChannelState

void onUpdateChannelState(ChannelState fromState, ChannelState toState);

Notification of change in SDK connection status

Parameters
ParameterDescription
fromStatePre-change status. See details in ChannelState.
toStateCurrent status

ChatRoomService.ChatRoomListener

ChatRoomListener.onChatRoomDismissed

void onChatRoomDismissed(@NonNull ChatRoom chatRoom, @NonNull User member);

Callback notification upon chatroom closure

Note:

Parameters
ParameterDescription
chatRoomChatroom ID
memberAn administrator closing the chatroom

ChatRoomListener.onBasicInfoChanged

void onBasicInfoChanged(@NonNull ChatRoom chatRoom,
                        @NonNull Map<ChatRoomInfo.BasicInfoType, String> propInfo);

Callback of changes to basic chatroom information

Note:

Parameters
ParameterDescription
chatRoomChatroom ID
propInfoA changed key-value pair. See BasicInfoType for reference enumeration of key values.

ChatRoomListener.onRoomInfoAddedOrUpdated

void onRoomInfoAddedOrUpdated(@NonNull ChatRoom chatRoom,
                              @NonNull User operator,
                              @NonNull Map<String, String> propInfo);

Callback of chatroom information added or updated.

Note:

You can call addOrUpdateChatRoomInfo to trigger the callback.

Parameters
ParameterDescription
chatRoomChatroom ID
operatorOperator changed the chatroom information
propInfoInformation changed

ChatRoomService.MemberListener

MemberListener.onMemberJoined

void onMemberJoined(@NonNull ChatRoom chatRoom, @NonNull List<User> members);

Callback of members joining the chatroomm

Note:

Parameters
ParameterDescription
chatRoomChatroom ID
membersMembers joining the chatroom

MemberListener.onMemberLeaved

void onMemberLeaved(@NonNull ChatRoom chatRoom,
                    @NonNull List<User> members,
                    int type,
                    @NonNull String reason);

Callback of members exiting the chatroom

Note:

This callback is deprecated, use onChatRoomMemberOffline or onChatRoomMemberLeave instead.

Parameters
ParameterDescription
chatRoomChatroom ID
membersMembers exiting the chatroom
typeOperation types for exiting the chatroom
0: LEAVING, 1: DISCONNECTED
reasonReasons for exiting the chatroom

MemberListener.onChatRoomMemberOffline

void onChatRoomMemberOffline(@NonNull ChatRoom chatRoom);

Callback of user exited the chatroom for network disconnect timeout

Note:

This callback is triggered only when the network disconnect timeout

Parameters
ParameterDescription
chatRoomChatroom ID

MemberListener.onChatRoomMemberLeave

void onChatRoomMemberLeave(@NonNull ChatRoom chatRoom, @NonNull List<User> members);

Callback of member exited the chatroom.

Note:

You can call leaveChatRoom to trigger the callback.

Parameters
ParameterDescription
chatRoomChatroom ID
membersMembers exited the chatroom

MemberListener.onMemberCountChanged

void onMemberCountChanged(@NonNull ChatRoom chatRoom, int count);

Callback of changes to chatroom member count

Note:

Parameters
ParameterDescription
chatRoomChatroom ID
countA changed count

MemberListener.onMemberKicked

void onMemberKicked(@NonNull ChatRoom chatRoom,
                    @NonNull User admin,
                    @NonNull List<User> members,
                    @NonNull String reason);

Callback of chatroom members removal

Note:

This callback is deprecated, use onMemberKicked instead.

Parameters
ParameterDescription
chatRoomChatroom ID
adminAn administrator executing member removal
membersMembers removed from channel
reasonReasons for member removal

[New]MemberListener.onMemberKicked

void onMemberKicked(@NonNull ChatRoom chatRoom,
                    @NonNull User admin,
                    @NonNull List<User> members,
                    @NonNull KickOff kickOff);

Callback of member kicked out the chatroom.

Note:

You can call kick to trigger the callback.

Parameters
ParameterDescription
chatRoomChatroom ID
adminAdmin user
membersMember kicked out of the chatroom
kickOffThe reason for being kicked out, see details in KickOff

MemberListener.onRoleAdded

void onRoleAdded(@NonNull ChatRoom chatRoom,
                 @NonNull String role,
                 @NonNull User admin,
                 @NonNull User fellow);

Callback of role adding to chatroom members

Note:

  • Call addRole to perform callback.
Parameters
ParameterDescription
chatRoomChatroom ID
roleAn added role
adminAn administrator adding a role
fellowMember to whom role was added

MemberListener.onRoleRemoved

void onRoleRemoved(@NonNull ChatRoom chatRooA request context object, callback pass-through to extract context from listenerm,
                   @NonNull String role,
                   @NonNull User admin,
                   @NonNull User fellow);

Callback of role removal from chatroom members

Note:

Parameters
ParameterDescription
chatRoomChatroom ID
roleA removed role
adminAn administrator removing a role
fellowMember from whom role was removed

MemberListener.onMemberMuted

void onMemberMuted(@NonNull ChatRoom chatRoom,
                   @NonNull User operator,
                   @NonNull Set<User> members,
                   @Nullable String reason);

Callback of chatroom member muted

Note:

Parameters
ParameterDescription
chatRoomChatroom ID
operatorAn administrator for muting
membersMuted members
reasonReason for muting

MemberListener.onMemberUnmuted

void onMemberUnmuted(@NonNull ChatRoom chatRoom,
                     @NonNull User operator,
                     @NonNull Set<User> members,
                     @Nullable String reason);

Callback of chatroom members unmuted

Note:

Parameters
ParameterDescription
chatRoomChatroom ID
operatorAn administrator for unmuting
membersUnmuted members
reasonReason

MemberListener.onUserInfoSet

void onUserInfoSet(@NonNull ChatRoom chatRoom,
                   @NonNull User user,
                   @NonNull Map<String, String> infoMap);

Callback of setting information of a chatroom member

Note:

Parameters
ParameterDescription
chatRoomChatroom ID
userThe user whose information changed
infoMapUser information set

MemberListener.onUserInfoDeleted

void onUserInfoDeleted(@NonNull ChatRoom chatRoom,
                       @NonNull User user,
                       @NonNull Map<String, String> infoMap);

Callback of user information being deleted.

Note:

-You can call deleteUserInfoByKeys to trigger the callback.

Parameter
ParameterDescription
chatRoomChatroom ID
userUser The user whose information changed
infoMapDeleted user information

MemberListener.onUserInfoAddedOrUpdated

void onUserInfoAddedOrUpdated(@NonNull ChatRoom chatRoom,
                              @NonNull User user,
                              @NonNull Map<String, String> infoMap);

Callback of the member information added or updated.

Note:

You can call addOrUpdateUserInfo to tigger the callback.

Parameter
ParameterDescription
chatRoomChatroom ID
userUser whose information changed
infoMapDeleted information

ChatService.MessageListener

MessageListener.beforeSendingMessage

void beforeSendingMessage(@NonNull Message message);

This callback precedes your calling ChatService.send(Message, HMR.Completion) to send a message.

It is commonly used to add the message to a session rendering interface before sending or to store the message in a database.

Parameters
ParameterDescription
messageMessage sent

MessageListener.afterSendingMessage

void afterSendingMessage(@NonNull Message message);

This callback occurs after you call ChatService.send(Message, HMR.Completion) to send a message (regardless of message sending success or failure).

Parameters
ParameterDescription
messageMessage sent

MessageListener.beforeReceivingMessage

void beforeReceivingMessage(@NonNull Message message);

Perform this callback before message receiving and processing.

Parameters
ParameterDescription
messageMessage received

MessageListener.afterReceivingMessage

void afterReceivingMessage(@NonNull Message message);

Callback will be performed by this method when a new message is received.

Parameters
ParameterDescription
messageMessage received

Was this page helpful?

Helpful Not helpful
Submitted! Your feedback would help us improve the website.
Feedback
Top
<