If you delete the message history and message records for sync on the CommsEase server, the message history of the conversation in the local database will also be deleted, but the conversation in the database will be retained. You can delete the conversations in the local database by calling {@link NIMGetInstanceOptions.deleteLocalSession}.
If isSyncSelf is set to true, the account logged in on multiple devices will trigger onClearServerHistoryMsgs
Extension field
Whether to delete message history for sync. Default value: true
Specify whether to sync messages across devices. The default value is false
Messaging use case
The user you talk with。 If the current session is a private chat, the IM account (accid) of the peer is used; if the current session is a group chat, the group ID is used.
done callback. You must define the function.
Delete all local messages. This method will clear all conversations in the database at the same time.
Note: If the operating environment does not support the database, or the database is not running, the execution is successful, but no valid data will be returned or operated.
Delete a local message.
lastMsg
property of the conversation will automatically change to the previous message, and the onupdatesessions callback will be triggered.Delete local messages based on conversation ID, start time and end time
Timestamp of the end time for a search
session.id
Timestamp of the start time for a search
Whether the conversation is synced. The default value is true
done callback. You must code the callback based on the requirements.
Delete all local messages in a specific conversation
Note: If the operating environment does not support the database, or the database is not running, the execution is successful, but no valid data will be returned or operated.
Whether session.lastMsg will also be deleted. The default value is false
Whether the message is deleted by tag. The default value is false
Note: If it is true, the message is deleted physically, and the localCustom local custom extension field inserted for this message cannot be retained. If the value is false, the message is deleted by logic.
Messaging use case
The user you talk with。 If it is a private message, pass the account of the peer. For group chats, pass the group ID.
Delete the messages of the specified time range at a time.
Note: If the operating environment does not support the database, or the database is not running, the execution is successful, but no valid data will be returned or operated.
Timestamp of the end time. Use Infinity by default if unspecified.
Timestamp of start time in milliseconds, default value: 0
Callback invoked when a message is deleted. You can search for messages after this callback.
Get the message history stored on the CommsEase server. The time range is defined by the parameters beginTime
and endTime
.
reverse
is set to false, the endTime of the subsequent query corresponds to the time field of the last message of the previous query.reverse
is set to true, the beginTime of the subsequent query corresponds to the time field of the last message of the previous queryThis API call is triggered when users opens a conversation and render the message list or "pulls down to view more messages".
Sorting order. The default value is false
false means that the returned messages are sorted in descending order by time;
true means the returned messages are sorted in ascending order by time;
Timestamp of start time in milliseconds, default value: 0
Timestamp of the end time in milliseconds. the default value: 0
The idServer of the last message in the last query. No value for the first query.
limit on the number of queries per page, the default value is 100
Specified message type. All message types if unspecified
Query order. The default value is false, indicating the result is displayed in descending order.
false Search limit number of history messages forward from endTime
true Search limit number of history messages backward from beginTime
Messaging use case
The user you talk with。 If it is a private message, pass the account of the peer. For group chats, pass the group ID.
done callback. You must define the function.
Retrieve message history from the local database.
This API call is triggered when users opens a conversation and render the message list or "pulls down to view more messages".
If the runtime environment does not support the database, or the database is not running, the execution is successful, but no valid data be returned.
true means search from end
, false means search from begin
Timestamp of the end time for a search
[indexedDB only] If parameters are provided, query messages matching this keyword
Note: The query with this parameter is in the forward index mode, and the query will be quite slow when the amount of data is large. If you need to support full-text search (inverted index structure), see fts interfaces
Pagination limit
If specified, search messages in this conversation
Timestamp of the start time for a search
[for indexedDB only] If this parameter is provided, query these subtypes of messages
[for indexedDB only] If this parameter is provided, query this type of message
Get the local message history by the client message IDs (idClients).
If the runtime environment does not support the database, or the database is not running, the execution is successful, but no valid data be returned.
Client message IDs
done callback. You must define the function
Full-text search for message history on the server. The returned messages will be classified by session, not by time.
Search message history of all conversations stored on the CommsEase server based on the time range and keywords.
The "full-text search message" setting has been activated in the CommsEase console.
Configuration: Select the application, and select IM Basic/Pro > Settings > Global > Full-text message search.
The start time of the search, the default value 0 means unlimited
Keyword for search
Limit on the number of returned messages per conversation Default value: 5. For example, if you pass 1, each conversation returns 1 matching message.
Message subtype, which can be customized when sending messages, and the format is an integer greater than 0. Example: [1, 2]
message type, Example: ['text', 'image', 'audio', 'video', 'geo', 'notification', 'file', 'tip', 'custom']
Sorting rule for returned messages. The messages are sorted in descending order DESC by default. optional ASC ascending order.
Search condition for private chats, account for sessions (p2p-accid1), example: ['accid1', 'accid2', 'accid3']
List of message senders, Example: ['accid1', 'accid2', 'accid3']
Limit on the number of conversations The default value is 10. For example, if you pass 5, messages in 5 sessions are retrieved and returned
Search condition Group list. Search messages from these groups (team-146694936), example: ['146694936', '13897']
The end time of the search, the default value is the current time
Full-text search for messages (search by time). the returned messages are sorted in descending order by time.
Search message history of all conversations stored on the CommsEase server based on the time range and keywords.
The "full-text search message" setting has been activated in the CommsEase console.
Configuration: Select the application, and select IM Basic/Pro > Settings > Global > Full-text message search.
The start time of the search, the default value 0 means unlimited
Keyword for search
Limit on the number of returned messages per conversation Default value: 5. For example, if you pass 1, each conversation returns 1 matching message.
Message subtype, which can be customized when sending messages, and the format is an integer greater than 0. Example: [1, 2]
message type, Example: ['text', 'image', 'audio', 'video', 'geo', 'notification', 'file', 'tip', 'custom']
Sorting rule for returned messages. The messages are sorted in descending order DESC by default. optional ASC ascending order.
Search condition for private chats, account for sessions (p2p-accid1), example: ['accid1', 'accid2', 'accid3']
List of message senders, Example: ['accid1', 'accid2', 'accid3']
Search condition Group list. Search messages from these groups (team-146694936), example: ['146694936', '13897']
The end time of the search, the default value is the current time
Store the message to the local database
Note: If the operating environment does not support the database, or the database is not running, the execution is successful, but no valid data will be returned or operated.
Update local messages. Only localCustom local custom extension fields are allowed to be updated.
If the runtime environment does not support the database, or the database is not running, the execution is successful, but no valid data will be returned.
Client message ID
local custom extension field
done callback. You must define the function
Interface definitions for message history