SDKsWASMEnterprise
Load message history in reverse
Retrieve history from a message anchor toward newer messages.
Use the reverse history API when you already have a message anchor and need to fill in messages that come after it.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationID | string | Yes | ID of the conversation whose messages to retrieve. |
startClientMsgID | string | Yes | Anchor message ID from which to read toward newer messages. |
count | number | Yes | Maximum number of messages to retrieve. |
viewType | MessageViewType | Yes | Message 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.
Was this page helpful?