Report group messages as read
Report group-message read receipts with the WASM SDK.
await openimsdk.sendGroupMessageReadReceipt({
conversationID,
clientMsgIDList: visibleUnreadMessageIDs,
});Every message in one batch must belong to the target group conversation. Promise completion means only that the server accepted the report; it does not mean other client interfaces have already updated. The conversation unread count is maintained separately through markConversationMessageAsRead().
Other clients receive member-level group read changes through SdkEvent.OnRecvGroupReadReceipt. The complete listener for that event is provided on this page. When an event arrives, use conversationID + clientMsgID to find the matching message and update its hasReadCount, unreadCount, and member information.
import { SdkEvent } from '@openim/wasm-client-sdk';
const handleGroupReadReceipt = ({ data }) => {
mergeGroupReadReceipt(data);
};
openimsdk.on(SdkEvent.OnRecvGroupReadReceipt, handleGroupReadReceipt);
function removeGroupReadReceiptListener() {
openimsdk.off(SdkEvent.OnRecvGroupReadReceipt, handleGroupReadReceipt);
}Call removeGroupReadReceiptListener() when the component unmounts, the user logs out, or the active account changes. The report Promise, the group receipt event, and the member list returned by Get members who read a group message are three independent stages.
Was this page helpful?