Browse SDKs · uni-app / uni-app x
Platform
SDKsuni-app / uni-app xEnterprise

Send group read receipts

Report member-level read receipts for group messages and listen for group read status changes.

Copy

Member-level group read receipts are a Commercial Edition capability. All messages submitted in a single batch must belong strictly to the specified group conversation.

Parameters

ParameterTypeRequiredDescription
conversationIDstringYesTarget group conversation ID.
clientMsgIDsstring[]YesArray of clientMsgID values marking visible read messages.

Code example

import { sendGroupMessageReadReceipt } from '@/uni_modules/unix-openim-sdk'

await sendGroupMessageReadReceipt({
  conversationID,
  clientMsgIDs: visibleUnreadMessageIDs,
})

Do not mix message IDs from different conversations, and avoid sending receipts for messages that have not yet scrolled into visible view.

Return value

The Promise resolves with void upon successful server processing.

State changes after the call

Promise resolution indicates that the receipt report was processed by the server; it does not mean other client devices have finished rendering reader updates. Conversation unread counts are maintained separately by conversation-level read operations; this method exclusively tracks member-level reader details in groups.

Listen for group read receipt changes

Centrally register onRecvGroupReadReceipt to monitor group read receipts. The event provides an opaque string notification signal. Treat this signal as an invalidation trigger to re-query the reader breakdown for currently visible group messages.

import { off, onRecvGroupReadReceipt } from '@/uni_modules/unix-openim-sdk'

const handleGroupReadReceipt = (_payload: string) => {
  reloadVisibleGroupMessageReaders()
}

const groupReadReceiptSubscription =
  onRecvGroupReadReceipt(handleGroupReadReceipt)

function removeGroupReadReceiptListener() {
  off(groupReadReceiptSubscription)
}

Reporting receipts, receipt event arrival, and querying readers via Get group message readers represent three decoupled stages. Unregister the listener when leaving the conversation or switching accounts.