sendGroupMessageReadAck method
~english Sends the group message receipt to the server.
You can call the method only after setting the following method: ChatOptions.requireAck and ChatMessage.needGroupAck.
Note
- This method takes effect only after you set ChatOptions.requireAck and ChatMessage.needGroupAck as
true
. - This method applies to group messages only. To send a one-to-one chat message receipt, call sendMessageReadAck; to send a conversation receipt, call sendConversationReadAck.
Param msgId
The message ID.
Param groupId
The group ID.
Param content
The extension information, which is a custom keyword that specifies a custom action or command.
Throws A description of the exception. See ChatError. ~end
~chinese 发送群消息已读回执。
前提条件:设置了ChatOptions.requireAck 和 ChatMessage.needGroupAck 都为 true
。
Note 发送单聊消息已读回执,详见 sendMessageReadAck; 会话已读回执,详见 sendConversationReadAck;
Param msgId
消息 ID。
Param groupId
群组 ID。
Param content
扩展信息。用户自己定义的关键字,接收后,解析出自定义的字符串,可以自行处理。
Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 ChatError。 ~end
Implementation
Future<void> sendGroupMessageReadAck(
String msgId,
String groupId, {
String? content,
}) async {
Map req = {
"msg_id": msgId,
"group_id": groupId,
};
req.putIfNotNull("content", content);
Map result =
await ChatChannel.invokeMethod(ChatMethodKeys.ackGroupMessageRead, req);
try {
ChatError.hasErrorFromResult(result);
} on ChatError catch (e) {
throw e;
}
}