downloadMergerMessage

Introduction

Download the message instances for merged messages.

Parameter details

Parameter name Parameter type Required Description
msgID string yes The merged message ID.

Returned template

V2TimValueCallback<V2TimMessage[]>

{
    code : number
    desc : string
    data : V2TimMessage[]
}

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.
data V2TimMessage[] The list of original messages instances from merged messages.

Code example

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


const listener = {
    onRecvNewMessage: async (message) => {

        if (message.elemType === MessageElemType.V2TIM_ELEM_TYPE_MERGER) {
            message.mergerElem?.abstractList;
            message.mergerElem?.isLayersOverLimit;
            message.mergerElem?.title;

            const download = await TencentImSDKPlugin.v2TIMManager
                .getMessageManager()
                .downloadMergerMessage(message.msgID!);
            if (download.code === 0) {
                download.data!;
            }
        }
    },
};

TencentImSDKPlugin.v2TIMManager
    .getMessageManager()
    .addAdvancedMsgListener(listener);


const createMergerMessageResult = await TencentImSDKPlugin.v2TIMManager
    .getMessageManager()
    .createMergerMessage(
        [
            'msgid1',
            'msgid2',
        ],
        'user1与user2的聊天',
        ['user1:hello', 'user2:你好'],
        '当前版本不支持该消息'
    );
if (createMergerMessageResult.code == 0) {




    TencentImSDKPlugin.v2TIMManager.getMessageManager().sendMessage({
        id: createMergerMessageResult.data!.id!,
        receiver: 'receiver',
        groupID: 'groupID',
    });
}

results matching ""

    No results matching ""