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
sendPrivateReadReceiptMessage(
targetId: string,
channelId: string,
timestamp: number,
callback: IRCIMIWSendPrivateReadReceiptMessageCallback
): Promise<number>;
Parameter Description
Parameter Name | Parameter Type | Description |
---|---|---|
targetId | string | Conversation ID |
channelId | string | Channel ID, only supported for ultra groups, pass null for other conversation types. |
timestamp | number | The timestamp of the last message read in the conversation |
callback | IRCIMIWSendPrivateReadReceiptMessageCallback | Callback for the interface call result. |
Return Value
Return Value | Description |
---|---|
number | The status code of the current interface operation. 0 indicates success, specific results need to be implemented in the interface callback, non-0 indicates failure, detailed errors refer to the error code |
Code Example
const callback = {
onPrivateReadReceiptMessageSent: (code: number) => {
//...
},
};
let code = await engine.sendPrivateReadReceiptMessage(targetId, channelId, timestamp, callback);
Set Message Receipt Listener
Set the message receipt listener to receive message receipts.
Method
setOnPrivateReadReceiptReceivedListener(listener?: (targetId: string, channelId: string, timestamp: number) => void): void;
Parameter Description
Parameter Name | Parameter Type | Description |
---|---|---|
targetId | string | Conversation ID |
channelId | string | Channel ID, only supported for ultra groups, pass null for other conversation types. |
timestamp | number | The sendTime of the last message read |
Code Example
engine?.setOnPrivateReadReceiptReceivedListener((targetId: string, channelId: string, timestamp: number) => {
//...
});