sendMessageReadReceipts

Introduction

send a message read receipts

After receiving the message, the receiver determines whether the message requires a read receipt based on the needReadReceipt field in V2TIMMessage.

If yes, after the user reads the message, the receiver calls the this method to send a read receipt.

This method only works with Ultimate Edition, you can find the pricing plan here.

All the messages provided needs to be in the same group, it group messages provided.

After the receiver sends a message read receipt, the sender can listen for a receipt notification through onRecvMessageReadReceipts in V2TimAdvancedMsgListener and update the UI based on the notification to display the message as, for example, "Read by two members".

Specifying a group type for which to support message read receipts: Log in to the IM console, select Feature Configuration > Login and Message > Group Message Read Receipts.

Parameter details

Parameter name Parameter type Required Description
messageIDList string[] yes The read messages list.

Returned template

V2TimCallback

{
    code : number
    desc : string
}

Return value details

name type description
code number Request result: Error codes. 0 means success.
desc string The description of the error. It will be empty if success.

Code example

import { TencentImSDKPlugin } from 'react-native-tim-js';


const createCustomMessageRes = await TencentImSDKPlugin.v2TIMManager
    .getMessageManager()
    .createCustomMessage({
        data: '正在输入中',
    });

TencentImSDKPlugin.v2TIMManager.getMessageManager().sendMessage({
    id: createCustomMessageRes.data!.id!,
    receiver: '',
    groupID: 'groupID',
    onlineUserOnly: true,
    needReadReceipt: true,
});


const sendMessageReadReceipts = await TencentImSDKPlugin.v2TIMManager
    .getMessageManager()
    .sendMessageReadReceipts([createCustomMessageRes.data!.id!]);
if (sendMessageReadReceipts.code === 0) {

} else {

}

results matching ""

    No results matching ""