Browse SDKs · WASM
Platform
SDKsWASMEnterprise

Load message history in reverse

Retrieve history from a message anchor toward newer messages.

Copy

Use the reverse history API when you already have a message anchor and need to fill in messages that come after it.

Parameters

ParameterTypeRequiredDescription
conversationIDstringYesID of the conversation whose messages to retrieve.
startClientMsgIDstringYesAnchor message ID from which to read toward newer messages.
countnumberYesMaximum number of messages to retrieve.
viewTypeMessageViewTypeYesMessage viewing direction. Use MessageViewType.History when loading history.
import { MessageViewType } from '@openim/wasm-client-sdk';

const { data: page } =
  await openimsdk.getAdvancedHistoryMessageListReverse({
    conversationID,
    startClientMsgID: anchorMessage.clientMsgID,
    count: 30,
    viewType: MessageViewType.History,
  });

When the Promise resolves, data is an AdvancedMessageListResult. For complete field specifications, see Load message history. Here, isEnd indicates whether pagination has reached the newest available message boundary.

Do not mix both loading directions at the same scroll boundary. When adding queried messages to the list, deduplicate them by conversationID:clientMsgID.