getC2CHistoryMessageList

Introduction

Call this method to load historical one-to-one c2c messages.

When historical messages are loading from the cloud and a network exception is noticed, the SDK will return the locally stored historical messages.

Locally stored historical messages are not subject to time limits, but those stored in the cloud are subject to the following time limits:

Trial edition: The free storage period is 7 days and cannot be extended.

Pro edition: The free storage period is 7 days and can be extended.

Ultimate edition: The free storage period is 30 days and can be extended.

Extending the storage period of historical messages is a value-added service. You can log in to the IM console to modify the relevant configuration. For billing details, see Pricing.

Rich media messages (such as images, files, and audios) have the same storage periods as historical messages.

Message Storage Policy

FAQs

Parameter details

Parameter name Parameter type Required Description
userID string yes The user ID of the target user.
count number yes The amount of the messages loaded once a request, do not set it so large that might affect the speed of processing.
lastMsgID string no The starting point of loading messages, it will start from the latest message, if not provided.

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 messages loaded.

Code example

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

const getC2CHistoryMessageListRes = await TencentImSDKPlugin.v2TIMManager
    .getMessageManager()
    .getC2CHistoryMessageList(
        'userId',
        10
    );
if (getC2CHistoryMessageListRes.code === 0) {

}

results matching ""

    No results matching ""