Mark a conversation as read
OpenIM uni-app / uni-app x SDK guide for Mark a conversation as read.
Use markConversationMessageAsRead() to clear ordinary unread state for one conversation. The commercial resetConversationUnread() is an additional entry that can set unread count for multiple conversations. One-to-one message read receipts arrive through onRecvC2CReadReceipt.
import { markConversationMessageAsRead, off, onRecvC2CReadReceipt } from '@/uni_modules/unix-openim-sdk'
const receiptSubscription = onRecvC2CReadReceipt((result) => {
result.receipts.forEach((receipt) => mergeReadReceipt(receipt))
})
await markConversationMessageAsRead(conversationID)The Commercial reset operation uses:
import { resetConversationUnread } from '@/uni_modules/unix-openim-sdk'
await resetConversationUnread({ conversationIDs: [conversationID], num: 0 })Local unread reset and a remote read receipt are not the same stage. After Promise success, merge the latest conversation from onConversationChanged by conversationID or requery it. For a one-to-one receipt, locate the peer's conversation and update the messages listed in each receipt.
For a group conversation, this API clears only the current account's conversation unread count. Use Send group read receipts for member-level group read state. Release receiptSubscription on component teardown, logout, or account switch:
off(receiptSubscription)Was this page helpful?