Multi-Device Synchronization of Read Status
Synchronize Unread Message Status
When logging in from multiple devices, notify other terminals to synchronize the unread message status of a specific conversation.
Method
syncConversationReadStatus(
type: RCIMIWConversationType,
targetId: string,
channelId: string,
timestamp: number,
callback: IRCIMIWSyncConversationReadStatusCallback
): Promise<number>;
Parameter Description
Parameter | Type | Description |
---|---|---|
type | RCIMIWConversationType | Conversation type |
targetId | string | Conversation ID |
channelId | string | Channel ID, only supported for ultra groups. For other conversation types, pass null. |
timestamp | number | The timestamp of the last read message in the conversation |
callback | IRCIMIWSyncConversationReadStatusCallback | Callback for the result of the interface call. |
Return Value
Return Value | Description |
---|---|
number | The status code of the current interface operation. 0 indicates a successful call. The specific result needs to be implemented in the interface callback. Non-zero indicates that the current interface call operation failed, and the interface callback will not be triggered. For detailed errors, refer to the error codes. |
Code Example
const callback = {
onConversationReadStatusSynced: (code: number) => {
//...
},
};
let code = await engine.syncConversationReadStatus(type, targetId, channelId, timestamp, callback);
Listen for Synchronized Unread Message Status
When a user calls syncConversationReadStatus
to synchronize the unread message status, the remote user will receive this callback.
Method
setOnConversationReadStatusSyncMessageReceivedListener(listener?: (type: RCIMIWConversationType, targetId: string, timestamp: number) => void): void;
Parameter Description
Parameter | Type | Description |
---|---|---|
type | RCIMIWConversationType | Conversation type |
targetId | string | Conversation ID |
timestamp | number | Timestamp |
Code Example
engine?.setOnConversationReadStatusSyncMessageReceivedListener(
(type: RCIMIWConversationType, targetId: string, timestamp: number) => {
//...
}
);