Browse SDKs · iOS
Platform
SDKsiOSEnterprise

Report group-message read status

Report group-message read receipts with OpenIM iOS SDK.

Copy

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

ParameterTypeRequiredDescription
conversationIDNSString *YesTarget group conversation identifier.
clientMsgIDsNSArray<NSString *> *YesArray of client message IDs visible and read on the screen. All IDs in a batch must belong to the same group conversation.
onSuccessOIMSuccessCallbackYesSuccess callback confirming receipts were accepted by the server.
onFailureOIMFailureCallbackYesFailure 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

  1. Client merge key: The merge key is clientMsgID scoped to conversationID. Upon receiving onRecvGroupReadReceipt:, update read and unread participant counters on the corresponding message bubble.
  2. 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.
  3. 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.