sendMessageReadAck method
- ChatMessage message
~english Sends the read receipt to the server.
This method applies to one-to-one chats only.
Warning
This method only takes effect if you set ChatOptions.requireAck as true
.
Note To send the group message read receipt, call sendGroupMessageReadAck.
We recommend that you call sendConversationReadAck when entering a chat page, and call this method to reduce the number of method calls.
Param message
The message body: ChatMessage.
Throws A description of the exception. See ChatError. ~end
~chinese 发送消息的已读回执,该方法只针对单聊会话。
Warning
该方法只有在 ChatOptions.requireAck 为 true
时才生效。
Note 群消息已读回执,详见 sendGroupMessageReadAck。
推荐进入会话页面时调用 sendConversationReadAck,其他情况下调用该方法以减少调用频率。
Param message
需要发送已读回执的消息。
Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 ChatError。 ~end
Implementation
Future<bool> sendMessageReadAck(ChatMessage message) async {
Map req = {"to": message.from, "msg_id": message.msgId};
Map result =
await ChatChannel.invokeMethod(ChatMethodKeys.ackMessageRead, req);
try {
ChatError.hasErrorFromResult(result);
return result.boolValue(ChatMethodKeys.ackMessageRead);
} on ChatError catch (e) {
throw e;
}
}