跳到主要内容

多端同步阅读状态

同步消息未读状态

多端登录时,通知其它终端同步某个会话的消息未读状态。

方法

TypeScript

syncConversationReadStatus(
type: RCIMIWConversationType,
targetId: string,
channelId: string,
timestamp: number,
callback: IRCIMIWSyncConversationReadStatusCallback
): Promise<number>;

参数说明

参数名参数类型描述
typeRCIMIWConversationType会话类型
targetIdstring会话 ID
channelIdstring频道 ID,仅支持超级群使用,其他会话类型传 null 即可。
timestampnumber会话中已读的最后一条消息的发送时间戳
callbackIRCIMIWSyncConversationReadStatusCallback接口调用结果回调。

返回值

返回值描述
number当次接口操作的状态码。0 代表调用成功 具体结果需要实现接口回调,非 0 代表当前接口调用操作失败,不会触发接口回调,详细错误参考错误码

代码示例

TypeScript

const callback = {
onConversationReadStatusSynced: (code: number) => {
//...
},
};
let code = await engine.syncConversationReadStatus(type, targetId, channelId, timestamp, callback);

监听同步消息未读状态

当用户调用syncConversationReadStatus同步消息未读状态时,远端用户会收到该回调

方法

TypeScript
setOnConversationReadStatusSyncMessageReceivedListener(listener?: (type: RCIMIWConversationType, targetId: string, timestamp: number) => void): void;

参数说明

参数名参数类型描述
typeRCIMIWConversationType会话类型
targetIdstring会话 ID
timestampnumber时间戳

代码示例

TypeScript

engine?.setOnConversationReadStatusSyncMessageReceivedListener(
(type: RCIMIWConversationType, targetId: string, timestamp: number) => {
//...
},
);