跳到主要内容

多端同步阅读状态

同步消息未读状态

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

方法

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

参数说明

参数类型说明
typeRCIMIWConversationType会话类型
targetIdstring会话 ID
channelIdstring频道 ID,暂不支持该参数。传 null 即可。
timestampnumber该会话中已读的最后一条消息的发送时间戳

代码示例

engine.syncConversationReadStatus(
type,
targetId,
channelId,
timestamp
)
.then((code: number) => {});

返回值

返回值描述
Promise<number>当次接口操作状态码,并不代表最终操作结果,状态码详细信息

代码示例

engine.syncConversationReadStatus(
type,
useTargetId,
useChannelId,
times
)
.then((code: number) => {});

回调方法

  • setOnConversationReadStatusSyncedListener
setOnConversationReadStatusSyncedListener(listener?: (code: number, type: RCIMIWConversationType, targetId: string, channelId: string, timestamp: number) => void): void;

参数说明

参数类型说明
codenumber接口回调的状态码,0 代表成功,非 0 代表出现异常
typeRCIMIWConversationType调用接口时传入的会话类型
targetIdstring调用接口时传入的会话ID
channelIdstring调用接口时传入的频道 ID
timestampnumber该会话中已读的最后一条消息的发送时间戳

代码示例

main.engine?.setOnConversationReadStatusSyncedListener(
(
code: number,
type: RCIMIWConversationType,
targetId: string,
channelId: string,
timestamp: number
) => {}
);

监听同步消息未读状态

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

方法

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

参数说明

参数类型说明
typeRCIMIWConversationType会话类型
targetIdstring会话ID

代码示例

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