fetchMessageHistory method

Future<NIMResult<List<NIMChatroomMessage>>> fetchMessageHistory(
  1. {required String roomId,
  2. required int startTime,
  3. required int limit,
  4. required QueryDirection direction,
  5. List<NIMMessageType>? messageTypeList}
)

获取历史消息,可选择给定时间往前或者往后查询,若方向往前,则结果排序按时间逆序,反之则结果排序按时间顺序。 拉取到的消息中也包含聊天室通知消息。

roomId 聊天室id

startTime 时间戳,单位毫秒

limit 可拉取的消息数量,最多100条

direction 查询方向

messageTypeList 查询的消息类型

Implementation

Future<NIMResult<List<NIMChatroomMessage>>> fetchMessageHistory({
  required String roomId,
  required int startTime,
  required int limit,
  required QueryDirection direction,
  List<NIMMessageType>? messageTypeList,
}) {
  return _platform.fetchMessageHistory(
    roomId: roomId,
    startTime: startTime,
    limit: limit,
    direction: direction,
    messageTypeList: messageTypeList,
  );
}