Public Callback Function | Function Name |
---|---|
void | onStateCallback(void *context, bool isInitial, HMRState oldState, HMRState newState) |
void | onTokenInvalidCallback(void *context, HMRTokenInvalidCode code, const char *desc, int descsize) |
Public Callback Function | Function Name |
---|---|
void | onBasicInfoChanged(void *context, uint32_t chatroom, uint64_t operatorUser, const HMRKvArray *info) |
Public Callback Function | Function Name |
---|---|
void | onMemberJoined(void *context, uint32_t chatroom, const uint64_t *users, uint16_t usersize) |
void | onMemberLeaved(void *context, uint32_t chatroom, const uint64_t *users, uint16_t usersize) |
void | onMemberCountChanged(void *context, uint32_t chatroom, uint32_t count) |
void | onMemberKicked(void *context, uint32_t chatroom, uint64_t admin, const uint64_t *member, uint16_t membersize, const char *reason) |
void | onUserInfoSet(void *context, uint32_t chatroom, uint64_t user, const HMRKvArray *infos) |
Public Callback Function | Function Name |
---|---|
void | beforeSending(void *context, HMRMessage *message) |
void | afterSending(void *context, HMRMessage *message) |
void | onReceive(void *context, HMRMessage *message) |
typedef void(*HMRStateCallback)(void *context, bool isInitial, HMRState oldState, HMRState newState);
Callback of Hummer SDK status changes
Parameter | Description |
---|---|
context | A request context object, callback pass-through to extract context from listener |
isInitial | Callback is immediately triggered upon requesting HMRAddStateListener. This callback’s isInitial value is true; the value is false for subsequently received actual changes. |
oldState | Pre-change status. See details in HMRState. |
newState | Current status |
typedef void(*HMRTokenInvalidCallback)(void *context, HMRTokenInvalidCode code, const char *desc, int descsize);
Notification of invalid authentication token
Parameter | Description |
---|---|
context | RA request context object, callback pass-through to extract context from listener |
code | An invalid type. See details in HMRTokenInvalidCode. |
desc | Invalidation reason |
descsize | String length for invalidation reason |
void(*onBasicInfoChanged)(void *context, uint32_t chatroom, uint64_t operatorUser, const HMRKvArray *info);
Callback of changes to basic chatroom information
Note:
- Call HMRChatRoomChangeBasicInfo to perform callback.
Parameter | Description |
---|---|
context | A request context object, callback pass-through to extract context from listener |
chatroom | Chatroom ID |
operatorUser | An administrator changing chatroom information |
info | A changed key-value pair. See HMRChatRoomBasicInfoType for reference enumeration of key values. |
void(*onMemberJoined)(void *context, uint32_t chatroom, const uint64_t *users, uint16_t usersize);
Callback of members joining the chatroom
Note:
- Call HMRJoinChatRoom to perform callback.
Parameter | Description |
---|---|
context | A request context object, callback pass-through to extract context from listener |
chatroom | Chatroom ID |
users | Members joining the chatroom |
usersize | Number of members |
void(*onMemberLeaved)(void *context, uint32_t chatroom, const uint64_t *users, uint16_t usersize);
Callback of members exiting the chatroom
Note:
- Call HMRLeaveChatRoom to perform callback.
- Causes a user experiencing disconnection timeout to exit the chatroom and receives callback for that user exiting.
Parameter | Description |
---|---|
context | A request context object, callback pass-through to extract context from listener |
chatroom | Chatroom ID |
users | Members exiting the chatroom |
usersize | Number of members |
void(*onMemberCountChanged)(void *context, uint32_t chatroom, uint32_t count);
Callback of changes to chatroom member count
Note:
- Call HMRJoinChatRoom and HMRLeaveChatRoom to perform callback.
Parameter | Description |
---|---|
context | A request context object, callback pass-through to extract context from listener |
chatroom | Chatroom ID |
count | A changed count |
void(*onMemberKicked)(void *context, uint32_t chatroom, uint64_t admin, const uint64_t *member, uint16_t membersize, const char *reason);
Callback of chatroom members removal
Parameter | Description |
---|---|
context | A request context object, callback pass-through to extract context from listener |
chatroom | Chatroom ID |
admin | An administrator executing member removal |
member | Members removed from channel |
membersize | Number of members |
reason | Reasons for member removal |
void(*onUserInfoSet)(void *context, uint32_t chatroom, uint64_t user, const HMRKvArray *infos);
Callback of setting information of a chatroom member
Note:
- Call HMRChatRoomSetUserInfo to perform callback.
Parameter | Description |
---|---|
context | A request context object, callback pass-through to extract context from listener |
chatroom | Chatroom ID |
user | The user whose information changed |
infos | Set user information |
typedef void (*HMRMessageCallback)(void *context, HMRMessage *message);
Callback before message sending
Parameter | Description |
---|---|
context | A request context object, callback pass-through to extract context from listener |
message | Message to be sent. See details in HMRMessage. |
typedef void (*HMRMessageCallback)(void *context, HMRMessage *message);
Callback after message sending
Parameter | Description |
---|---|
context | A request context object, callback pass-through to extract context from listener |
message | Message sent. See details in HMRMessage. |
typedef void (*HMRMessageCallback)(void *context, HMRMessage *message);
Callback of message receiving
Parameter | Description |
---|---|
context | A request context object, callback pass-through to extract context from listener |
message | Message received. See detail in HMRMessage. |
struct HMRStateListener {
// Context object pointer for asynchronous request, which is generally the object pointer that initiates an asynchronous operation
void *context;
// Function pointer for status change callback; when Hummer internal working state changes, this method will be used for callback
// If listener is added to the main thread, the callback will also be scheduled to the main thread, otherwise, it will be scheduled for execution in the Hummer worker thread
HMRStateCallback onStateCallback;
// Function pointer for token invalidation callback
// If listener is added to the main thread, the callback will also be scheduled to the main thread, otherwise, it will be scheduled for execution in the Hummer worker thread
HMRTokenInvalidCallback onTokenInvalidCallback;
// Hummer Internal auxiliary data, not to be modified or used by service
void *preserved;
};
Information about SDK state listener
Parameter | Description |
---|---|
context | Context object pointer for asynchronous request |
onStateCallback | Status change callback function pointer. See details in onStateCallback. |
onTokenInvalidCallback | Token invalidation callback function pointer. See details in onTokenInvalidCallback. |
preserved | Reserved field |
enum HMRTokenInvalidCode
Token invalid type
Enumeration Value | Description |
---|---|
HMRTokenInvalidCode_Expired(1) | Expired |
struct HMRChatRoomListener {
// Context object pointer for asynchronous request, which is generally the object pointer that initiates an asynchronous operation
void *context;
/**
* Callback notification for basic information change of the chatroom
*
* @param context Context refers to passing through the context object carried in listener
* @param chatRoom Chatroom
* @param operatorUser Information modifier
* @param info Key value of changed information
*/
void(*onBasicInfoChanged)(void *context, uint32_t chatroom, uint64_t operatorUser, const HMRKvArray *info);
// Hummer Field reserved for internal use, not to be accessed or modified by service
void *reserved;
};
Chatroom event listener
Parameter | Description |
---|---|
context | Context object pointer for asynchronous request |
onBasicInfoChanged | Callback notification for basic information change of the chatroom. See details in onBasicInfoChanged. |
reserved | Reserved field |
struct HMRChatRoomMemberListener {
// Context object pointer for asynchronous request, which is generally the object pointer that initiates an asynchronous operation
void *context;
/**
* Callback notification for member removal from a chatroom
*
* @param context Context refers to passing through the context object carried in listener
* @param chatRoom Chatroom
* @param admin Administrator
* @param member User kicked out
* @param membersize Number of users removed
* @param reason Reason
*/
void(*onMemberKicked)(void *context, uint32_t chatroom, uint64_t admin, const uint64_t *member, uint16_t membersize, const char *reason);
/**
* Callback notification for members joining/exiting a chatroom
*
* @param context Context refers to passing through the context object carried in listener
* @param chatRoom Chatroom
* @param users Join/exit user
* @param usersize Number of users joining/exiting
*/
void(*onMemberJoined)(void *context, uint32_t chatroom, const uint64_t *users, uint16_t usersize);
void(*onMemberLeaved)(void *context, uint32_t chatroom, const uint64_t *users, uint16_t usersize);
/**
* Callback notification for member information configuration
*
* @param context Context refers to passing through the context object carried in listener
* @param chatRoom Chatroom
* @param user Members with changed information
* @param infos User information after setting
*/
void(*onUserInfoSet)(void *context, uint32_t chatroom, uint64_t user, const HMRKvArray *infos);
/**
* Callback notification for changes to member count
*
* @param context Context refers to passing through the context object carried in listener
* @param chatRoom Chatroom
* @param count Number of users after change
*/
void(*onMemberCountChanged)(void *context, uint32_t chatroom, uint32_t count);
// Hummer Field reserved for internal use, not to be accessed or modified by service
void *reserved;
};
Member event listener in the chatroom
Parameter | Description |
---|---|
context | Context object pointer for asynchronous request |
onMemberKicked | Callback notification formember removal from a chatroom. See details in onMemberKicked. |
onMemberJoined | Callback notification for members joining a chatroom. See details in onMemberJoined. |
onMemberLeaved | Callback notification for members exiting a chatroom. See details in onMemberLeaved. |
onUserInfoSet | Callback notification for member information configuration. See details in onUserInfoSet. |
onMemberCountChanged | Callback notification for changes to member count. See details in onMemberCountChanged. |
reserved | Reserved field |
struct HMRMessageListener {
// Pointer to a context object of an asynchronous request, which is generally the object pointer that initiates an asynchronous operation
void *context;
// target Object used for message filtering. When calling EmptyIdentity, the listener will receive all messages. Otherwise it only
// receives messages matching this target
HMRIdentity target;
// Callback before message sending. Receiving this callback means the message has been validated, and will be sent to receiver immediately
HMRMessageCallback beforeSending;
// Callback after message sending. Regardless of whether the message is sent successfully or not, receiving this callback means the message sending process is completed. Sending success or failure
// may be judged according to the state field of the message object
HMRMessageCallback afterSending;
// Callback of message receiving. When a message belonging to the current user is received by Hummer, it will be processed through this callback
HMRMessageCallback onReceive;
// Hummer Field reserved for internal use, not to be accessed or modified by service
void *reserved;
};
Message status listener
Parameter | Description |
---|---|
context | Context object pointer for asynchronous request |
target | Object ID for message filtering |
beforeSending | Callback before message sending. See details in beforeSending. |
afterSending | Callback after message sending. See details in afterSending. |
onReceive | Callback of message receiving. See details in onReceive. |
reserved | Reserved field |