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
Parameter | Type | Description |
---|---|---|
targetId | String | Conversation ID |
channelId | String | Channel ID, only supported for ultra groups. For other conversation types, pass null. |
timestamp | int | The timestamp of the last read message in the conversation |
callback | IRCIMIWSendPrivateReadReceiptMessageCallback | Event 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 Value | Description |
---|---|
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
Parameter | Type | Description |
---|---|---|
code | int | The status code of the interface callback. 0 indicates success, non-zero indicates an exception. |
targetId | String | Conversation ID |
channelId | String | Channel ID, only supported for ultra groups. For other conversation types, pass null. |
timestamp | int | Timestamp |
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
Parameter | Type | Description |
---|---|---|
targetId | String | Conversation ID |
channelId | String | Channel ID, only supported for ultra groups. For other conversation types, pass null. |
timestamp | int | The sendTime of the last read message |
Code Example
engine?.onPrivateReadReceiptReceived = (String? targetId, String? channelId, int? timestamp) {
//...
};