needReadReceipt
field in V2TimMessage
(Details) and then sends the message to the conversation.const data = 'Typing...';const createCustomMessageRes =await TencentImSDKPlugin.v2TIMManager.getMessageManager().createCustomMessage(data);// Set `needReadReceipt` to `true` when sending the messageTencentImSDKPlugin.v2TIMManager.getMessageManager().sendMessage(id: createCustomMessageRes.data.id, receiver: "", groupID: "groupID",onlineUserOnly: true,needReadReceipt: true);
needReadReceipt
field in V2TIMMessage
(Details). If yes, after the user reads the message, the receiver calls the sendMessageReadReceipts
API (Details) to send a read receipt.const sendMessageReadReceipts = await TencentImSDKPlugin.v2TIMManager.getMessageManager().sendMessageReadReceipts(["msgids"]);if (sendMessageReadReceipts.code == 0) {// Succeeded} else {// Failed}
onRecvMessageReadReceipts
callback (Details) of V2TimAdvancedMsgListener
and update the UI based on the notification to display the message as, for example, "Read by two members".onRecvMessageReadReceipts: (receiptList) {receiptList.forEach((element) {element.groupID; // Group IDelement.msgID; // Message IDelement.readCount;// Latest read count of the group messageelement.unreadCount;// Latest unread count of the group messageelement.userID; // ID of the other party of the one-to-one message});},
getMessageReadReceipts
API (Details) to pull the message read receipt information.V2TimessageReceipt
field of the message read receipt is as described below:Attribute | Description | Remarks |
msgID | Message ID | Unique message ID |
userID | ID of the receiver | If the message is a one-to-one message, this field indicates the ID of the receiver. |
timestamp | Time when the receiver marks the message as read | This field is invalid when a message is read. If the message is a one-to-one message, when the receiver calls the markC2CMessageAsRead API to mark the message as read, the sender will receive the onRecvC2CReadReceipt callback which contains the timestamp information. |
groupID | Group ID | If the message is a group message, this field indicates the group ID. |
readCount | Number of members who have read the group message | If the message is a group message, this field indicates the number of members who have read the message. |
unreadCount | Number of members who have not read the group message | If the message is a group message, this field indicates the number of members who have not read the message. |
const getMessageReadReceipts = await TencentImSDKPlugin.v2TIMManager.getMessageManager().getMessageReadReceipts([]);if(getMessageReadReceipts.code == 0){getMessageReadReceipts.data.forEach((element) {// Parse the group message read receiptelement.groupID;element.msgID;element.readCount;element.timestamp;element.unreadCount;element.userID;});}
getGroupMessageReadMemberList
API (Details) to pull the member list by page.const messageID = "";const filter =GetGroupMessageReadMemberListFilter.V2TIM_GROUP_MESSAGE_READ_MEMBERS_FILTER_READ;const getGroupMessageReadMemberList = await TencentImSDKPlugin.v2TIMManager.getMessageManager().getGroupMessageReadMemberList(messageID, filter);if (getGroupMessageReadMemberList.code == 0) {// Get the list of members who have or have not read the group messagegetGroupMessageReadMemberList.data.isFinished;getGroupMessageReadMemberList.data.memberInfoList;getGroupMessageReadMemberList.data.nextSeq;}
Was this page helpful?