getAdvancedHistoryMessageListReverse
Feature Introduction
Description
Retrieve the historical chat records in a conversation in reverse order, suitable for pulling historical messages downwards when locating message context.
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- React-Native
- Unity
Function Prototype
Future<AdvancedMessage> getAdvancedHistoryMessageListReverse({
String? conversationID,
int? lastMinSeq,
Message? startMsg,
int? count,
String? operationID,
})
Input Parameters
Parameter Name | Data Type | Mandatory | Description |
---|---|---|---|
conversationID | Sting | Yes | Conversation ID |
startMsg | Message | Yes | Start querying [count] from this message. Index==length-1 is the latest message, so for the next page of historical records, startMsg=list.last |
count | int | Yes | Number of messages to retrieve in one fetch |
lastMinSeq | int | Yes | Don't provide for the first page of messages, required from the second page. Same as [startMsg] |
Return Result
Name | Type | Description |
---|---|---|
~ | AdvancedMessage | Success return |
Code Example
AdvancedMessage am = await OpenIM.iMManager.messageManager.getAdvancedHistoryMessageListReverse(
conversationID: '',
);
// todo
Function Prototype
- (void)getAdvancedHistoryMessageListReverse:(OIMGetAdvancedHistoryMessageListParam *)opts
onSuccess:(nullable OIMGetAdvancedHistoryMessageListCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;
Input Parameters
Parameter Name | Data Type | Mandatory | Description |
---|---|---|---|
OIMGetAdvancedHistoryMessageListParam.conversationID | NSSting | Yes | Conversation ID. If not empty, retrieve using conversation ID. Otherwise, retrieve using userID and groupID |
OIMGetAdvancedHistoryMessageListParam.startClientMsgID | NSString | Yes | Start message clientMsgID, "" for the first fetch |
OIMGetAdvancedHistoryMessageListParam.count | NSInteger | Yes | Number of messages to retrieve in one fetch |
OIMGetAdvancedHistoryMessageListParam.lastMinSeq | NSInteger | Yes | lastMinSeq is the value returned from the last fetch, needs to be provided for subsequent fetches |
Return Result
Name | Type | Description |
---|---|---|
onSuccess | NSArray< OIMGetAdvancedHistoryMessageListInfo * > | Success return |
onFailure | OIMFailureCallback | Failure return |
Code Example
OIMGetAdvancedHistoryMessageListParam *opts = [OIMGetAdvancedHistoryMessageListParam new];
opts.conversationID = @"";
opts.count = 30;
opts.lastMinSeq = @"";
[OIMManager.manager getAdvancedHistoryMessageListReverse:opts
onSuccess:^(OIMGetAdvancedHistoryMessageListInfo * _Nullable result) {
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
}];
Function Prototype
public void getAdvancedHistoryMessageListReverse(OnBase<AdvancedMessage> callBack, String conversationID, Message startMsg, int count)
Input Parameters
Parameter Name | Data Type | Mandatory | Description |
---|---|---|---|
callBack | OnBase<AdvancedMessage> | Yes | Callback interface |
conversationID | Sting | Yes | Conversation ID |
startMsg | Message | Yes | Start querying [count] from this message. Index==length-1 is the latest message, so for the next page of historical records, startMsg=list.first |
count | int | Yes | Number of messages to retrieve in one fetch |
Code Example
OpenIMClient.getInstance().messageManager. getAdvancedHistoryMessageListReverse(new OnBase<AdvancedMessage>() {
public void onError(int code, String error) {
}
public void onSuccess(AdvancedMessage data) {
}
} conversationID, startMsg, count);
Function Prototype
IMSDK.getAdvancedHistoryMessageListReverse({
lastMinSeq: number;
count: number;
startClientMsgID: string;
conversationID: string;
}, operationID?: string): Promise<WsResponse<AdvancedGetMessageResult>>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
conversationID | string | Yes | Conversation ID |
startClientMsgID | string | Yes | Initial message clientMsgID, first pull is "", subsequently, it's the last message's clientMsgID from the previous pull |
count | number | Yes | Number of messages pulled in one request |
lastMinSeq | number | Yes | lastMinSeq is the value returned from the previous pull, needed for the next pull |
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<WsResponse<AdvancedGetMessageResult>> | Successful callback |
Promise.catch() | Promise<WsResponse> | Failure callback |
Code Example
import { getSDK } from '@openim/wasm-client-sdk';
const IMSDK = getSDK();
// use in electron with ffi
// import { getWithRenderProcess } from '@openim/electron-client-sdk/lib/render';
// const { instance: IMSDK } = getWithRenderProcess();
// use in mini program
// import { getSDK } from '@openim/client-sdk';
// const IMSDK = getSDK();
IMSDK.getAdvancedHistoryMessageListReverse({
lastMinSeq: 0,
count: 20,
startClientMsgID: '',
conversationID: 'conversationID',
})
.then(({ data }) => {
// Success
})
.catch(({ errCode, errMsg }) => {
// Failure
});
Function Prototype
IMSDK.asyncApi('getAdvancedHistoryMessageListReverse', operationID: string, {
lastMinSeq: number;
count: number;
startClientMsgID: string;
conversationID: string;
}): Promise<AdvancedGetMessageResult>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
operationID | string | Yes | Operation ID, used for troubleshooting, must be unique, it's suggested to use the current time and a random number |
conversationID | string | Yes | Conversation ID |
startClientMsgID | string | Yes | Initial message clientMsgID, first pull is "", subsequently, it's the last message's clientMsgID from the previous pull |
count | number | Yes | Number of messages pulled in one request |
lastMinSeq | number | Yes | lastMinSeq is the value returned from the previous pull, needed for the next pull |
Return Result
With the
openim-uniapp-polyfill
package, the function is made into a Promise. When calling, you need to usethen
andcatch
to determine and handle the successful and failed callbacks.
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<AdvancedGetMessageResult> | Successful callback |
Promise.catch() | Promise<CatchResponse> | Failure callback |
Code Example
import IMSDK from 'openim-uniapp-polyfill';
IMSDK.asyncApi('getAdvancedHistoryMessageListReverse', IMSDK.uuid(), {
lastMinSeq: 0,
count: 20,
startClientMsgID: '',
conversationID: 'conversationID',
})
.then((data) => {
// Success
})
.catch(({ errCode, errMsg }) => {
// Failure
});
Function Prototype
OpenIMSDKRN.getAdvancedHistoryMessageListReverse({
lastMinSeq: number;
count: number;
startClientMsgID: string;
conversationID: string;
}, operationID: string): Promise<AdvancedGetMessageResult>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
operationID | string | Yes | Operation ID, used for troubleshooting, must be unique, it's suggested to use the current time and a random number |
conversationID | string | Yes | Conversation ID |
startClientMsgID | string | Yes | Initial message clientMsgID, first pull is "", subsequently, it's the last message's clientMsgID from the previous pull |
count | number | Yes | Number of messages pulled in one request |
lastMinSeq | number | Yes | lastMinSeq is the value returned from the previous pull, needed for the next pull |
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<AdvancedGetMessageResult> | Callback on successful call |
Promise.catch() | Promise<CatchResponse> | Callback on failed call |
Code Example
import OpenIMSDKRN from "open-im-sdk-rn";
OpenIMSDKRN.getAdvancedHistoryMessageListReverse({
lastMinSeq: 0,
count: 20,
startClientMsgID: '',
conversationID: 'conversationID',
}, 'operationID')
.then((data) => {
// Success
})
.catch(({ errCode, errMsg }) => {
// Failure
});
Function Prototype
public static void GetAdvancedHistoryMessageListReverse(OnBase<AdvancedMessage> cb, GetAdvancedHistoryMessageListParams getMessageOptions)
Input Parameter
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
callBack | OnBase<AdvancedMessage> | Yes | Callback |
getMessageOptions | GetAdvancedHistoryMessageListParams | Yes | Option |
Code Example
IMSDK.GetAdvancedHistoryMessageListReverse((historyMsgList,errCode,errMsg)=>{
},new GetAdvancedHistoryMessageListParams(){
});