getHistoryMessageList method
获取历史消息高级接口
参数
getType 拉取消息类型,可以设置拉取本地、云端更老或者更新的消息(具体类型在HistoryMessageGetType类中)
lastMsg/lastMsgSeq 用来表示拉取时的起点,第一次拉取时可以不填或者填 0;
请注意: 如果设置为拉取云端消息,当 SDK 检测到没有网络,默认会直接返回本地数据 只有会议群(Meeting)才能拉取到进群前的历史消息,直播群(AVChatRoom)消息不存漫游和本地数据库,调用这个接口无效
web 端使用该接口,消息都是从远端拉取,不支持lastMsgSeq
Implementation
Future<V2TimValueCallback<List<V2TimMessage>>> getHistoryMessageList({
HistoryMsgGetTypeEnum? getType = HistoryMsgGetTypeEnum.V2TIM_GET_LOCAL_OLDER_MSG,
String? userID,
String? groupID,
int lastMsgSeq = -1,
required int count,
String? lastMsgID,
List<int>? messageTypeList,
List<int>? messageSeqList,
int? timeBegin,
int? timePeriod,
}) async {
return TencentCloudChatSdkPlatform.instance.getHistoryMessageList(
getType: getType!.index,
userID: userID,
count: count,
lastMsgID: lastMsgID,
groupID: groupID,
lastMsgSeq: lastMsgSeq,
messageTypeList: messageTypeList ?? [],
messageSeqList: messageSeqList,
timeBegin: timeBegin,
timePeriod: timePeriod,
);
}