sendMessageReadAck method

Future<bool> sendMessageReadAck(
  1. EMMessage 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 EMOptions.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: EMMessage.

Throws A description of the exception. See EMError. ~end

~chinese 发送消息的已读回执,该方法只针对单聊会话。

Warning 该方法只有在 EMOptions.requireAcktrue 时才生效。

Note 群消息已读回执,详见 sendGroupMessageReadAck

推荐进入会话页面时调用 sendConversationReadAck,其他情况下调用该方法以减少调用频率。

Param message 需要发送已读回执的消息。

Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 EMError。 ~end

Implementation

Future<bool> sendMessageReadAck(EMMessage message) async {
  Map req = {"to": message.from, "msg_id": message.msgId};
  Map result =
      await ChatChannel.invokeMethod(ChatMethodKeys.ackMessageRead, req);
  try {
    EMError.hasErrorFromResult(result);
    return result.boolValue(ChatMethodKeys.ackMessageRead);
  } on EMError catch (e) {
    throw e;
  }
}