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​


sendPrivateReadReceiptMessage(
targetId: string,
channelId: string,
timestamp: number,
callback: IRCIMIWSendPrivateReadReceiptMessageCallback
): Promise<number>;

Parameter Description​

Parameter NameParameter TypeDescription
targetIdstringConversation ID
channelIdstringChannel ID, only supported for ultra groups, pass null for other conversation types.
timestampnumberThe timestamp of the last message read in the conversation
callbackIRCIMIWSendPrivateReadReceiptMessageCallbackCallback for the interface call result.

Return Value​

Return ValueDescription
numberThe 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 NameParameter TypeDescription
targetIdstringConversation ID
channelIdstringChannel ID, only supported for ultra groups, pass null for other conversation types.
timestampnumberThe sendTime of the last message read

Code Example​


engine?.setOnPrivateReadReceiptReceivedListener((targetId: string, channelId: string, timestamp: number) => {
//...
});