SDKsiOSEnterprise
Report group-message read status
Report group-message read receipts with OpenIM iOS SDK.
When group chat messages become visible on the user's screen, invoke sendGroupMessageReadReceipt:clientMsgIDs:onSuccess:onFailure: on OIMManager to report read status to the server. The server records the read timestamps and broadcasts receipt updates to other group members:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationID | NSString * | Yes | Target group conversation identifier. |
clientMsgIDs | NSArray<NSString *> * | Yes | Array of client message IDs visible and read on the screen. All IDs in a batch must belong to the same group conversation. |
onSuccess | OIMSuccessCallback | Yes | Success callback confirming receipts were accepted by the server. |
onFailure | OIMFailureCallback | Yes | Failure callback returning error code code and descriptive message msg. |
Code example
[[OIMManager manager] sendGroupMessageReadReceipt:conversationID
clientMsgIDs:visibleClientMsgIDs
onSuccess:^(NSString * _Nullable data) {
// Read receipts sent to server successfully
}
onFailure:^(NSInteger code, NSString * _Nullable msg) {
// Handle reporting failure
}];Return value
The onSuccess callback confirms that the read receipts were transmitted to and acknowledged by the server.
Listen for group read receipt events
When other members read messages in the group, the SDK dispatches updates via onRecvGroupReadReceipt: in OIMAdvancedMsgListener:
- (void)onRecvGroupReadReceipt:(OIMGroupMessageReceipt *)receipt {
if (receipt == nil) {
return;
}
// Update read/unread participant counts by conversationID and clientMsgID
[self mergeGroupReceipt:receipt];
}State changes after the call
- Client merge key: The merge key is
clientMsgIDscoped toconversationID. Upon receivingonRecvGroupReadReceipt:, update read and unread participant counters on the corresponding message bubble. - Conversation unread count separation: Reporting group message receipts informs other members of your read progress; update the local conversation's overall unread badge using the dedicated conversation-read API.
- Distinct operational phases: Reporting receipts, receiving incoming receipt broadcasts, and querying reader lists are distinct stages. To inspect the detailed list of members who have read a specific message, see Retrieve group-message readers. For listener setup, see Receive messages.
Was this page helpful?