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.
Parameter details
Parameter name | Parameter type | Required | Platform | Description |
---|---|---|---|---|
userID | String | yes | All | The user ID of the target user. |
count | int | yes | All | The amount of the messages loaded once a request, do not set it so large that might affect the speed of processing. But, on Web, it can not be larger than 15. |
lastMsgID | String | no | All | The starting point of loading messages, it will start from the latest message, if not provided. |
Returned template
V2TimValueCallback<List<V2TimMessage>>
{
code : int
desc : String
data : List<V2TimMessage>
}
Return value details
name | type | description |
---|---|---|
code | int | Request result: Error codes. 0 means success. |
desc | String | The description of the failure. |
data | List< V2TimMessage > | The list of messages loaded. |
Code example
V2TimValueCallback<List<V2TimMessage>> getC2CHistoryMessageListRes =
await TencentImSDKPlugin.v2TIMManager
.getMessageManager()
.getC2CHistoryMessageList(
userID: "userId",
count: 10,
lastMsgID: null,
);
if (getC2CHistoryMessageListRes.code == 0) {
}