Skip to main content

One-to-One Chat Message Receipt

Send Read Receipt

When user A sends a message to user B, after user B calls the send read receipt interface, user A will receive a read notification in the receipt listener.

Method

Future<int> sendPrivateReadReceiptMessage(String targetId, String? channelId, int timestamp, {IRCIMIWSendPrivateReadReceiptMessageCallback? callback});

Parameter Description

ParameterTypeDescription
targetIdStringConversation ID
channelIdStringChannel ID, only supported for ultra groups. For other conversation types, pass null.
timestampintThe timestamp of the last read message in the conversation
callbackIRCIMIWSendPrivateReadReceiptMessageCallbackEvent callback. The SDK supports callback-based responses starting from version 5.3.1. Other callback methods for this interface are deprecated as of version 5.4.0. If the callback parameter is provided, only the callback will be triggered.

Return Value

Return ValueDescription
Future<int>The status code of the current interface operation. 0 indicates a successful call. The specific result needs to be implemented in the interface callback. Non-zero indicates that the current interface call operation failed, and the interface callback will not be triggered. For detailed errors, refer to the error codes.

Code Example

IRCIMIWSendPrivateReadReceiptMessageCallback? callback = IRCIMIWSendPrivateReadReceiptMessageCallback(onPrivateReadReceiptMessageSent: (int? code) {
//...
});

int? ret = await engine?.sendPrivateReadReceiptMessage(targetId, channelId, timestamp, callback:callback);

Callback Method

  • onPrivateReadReceiptMessageSent

    Listener for the result of the interface call.

Function(int? code, String? targetId, String? channelId, int? timestamp)? onPrivateReadReceiptMessageSent;

Parameter Description

ParameterTypeDescription
codeintThe status code of the interface callback. 0 indicates success, non-zero indicates an exception.
targetIdStringConversation ID
channelIdStringChannel ID, only supported for ultra groups. For other conversation types, pass null.
timestampintTimestamp

Code Example

engine?.onPrivateReadReceiptMessageSent = (int? code, String? targetId, String? channelId, int? timestamp) {
//...
};

Set Message Receipt Listener

Set the message receipt listener to receive message receipts.

Method

Function(String? targetId, String? channelId, int? timestamp)? onPrivateReadReceiptReceived;

Parameter Description

ParameterTypeDescription
targetIdStringConversation ID
channelIdStringChannel ID, only supported for ultra groups. For other conversation types, pass null.
timestampintThe sendTime of the last read message

Code Example

engine?.onPrivateReadReceiptReceived = (String? targetId, String? channelId, int? timestamp) {
//...
};