多端同步阅读状态
同步消息未读状态
多端登录时,通知其它终端同步某个会话的消息未读状态。
方法
TypeScript
syncConversationReadStatus(
type: RCIMIWConversationType,
targetId: string,
channelId: string,
timestamp: number,
callback: IRCIMIWSyncConversationReadStatusCallback
): Promise<number>;
参数说明
参数名 | 参数类型 | 描述 |
---|---|---|
type | RCIMIWConversationType | 会话类型 |
targetId | string | 会话 ID |
channelId | string | 频道 ID,仅支持超级群使用,其他会话类型传 null 即可。 |
timestamp | number | 会话中已读的最后一条消息的发送时间戳 |
callback | IRCIMIWSyncConversationReadStatusCallback | 接口调用结果回调。 |
返回值
返回值 | 描述 |
---|---|
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;
参数说明
参数名 | 参数类型 | 描述 |
---|---|---|
type | RCIMIWConversationType | 会话类型 |
targetId | string | 会话 ID |
timestamp | number | 时间戳 |