Manage Offline Message Storage Configuration
The instant messaging service allows you to modify offline message configurations at both the App level and the user level.
Offline message configuration is only applicable to one-to-one chat and group chat. Chatrooms and ultra groups do not support offline messages due to their business characteristics, hence there are no offline message configurations for them.
Understanding Offline Messages
Offline messages? refer to messages received when a user is offline. RC's server automatically retains messages received during the user's offline period, with a default retention duration of 7 days. If the client comes online within 7 days, the server will directly send the offline messages to the receiving end. If the client does not come online within 7 days, the server will discard the expired messages.
Not all conversation types in the instant messaging service support offline messages:
- Supports offline messages: one-to-one chat, group chat, system message
- Does not support offline messages: chatroom, ultra group
App-Level Offline Message Configuration
You can modify the following App-level offline message storage settings:
- Offline message storage duration. You can modify the storage duration in the RC Console by navigating to Configuration > Chat settings > Basic features > One-to-One and Group Chat > Set Offline Message Storage Duration. When the target user is offline, the messages they receive will be saved to the offline messages, with a default storage duration of 7 days. The next time the user logs in, they will retrieve the offline messages. If adjustments are needed, they can be made here, with a range of 1 to 7 days. This setting only applies to one-to-one chat, group chat, and system message conversation types.
- Group offline message storage duration. When the target user is offline, the group messages they receive will be stored in the offline messages, with a default storage duration of 7 days. The user can retrieve these messages the next time they log in. If this item is not configured, the offline message storage duration for the group will be controlled by the "Set Offline Message Storage Duration" setting. If this item is configured, the offline storage duration for group messages will follow this configuration.
- Group offline message storage quantity. By default, all group messages within the last 7 days are stored. This can be modified by submitting a ticket. Configuration changes will affect all group chat sessions under the App.
User-Level Offline Message Configuration
The functions to set and retrieve a user's offline message storage duration require the User-Level Function Settings to be enabled. To enable this, please submit a ticket.
The instant messaging service supports user-level offline message configuration, allowing only the modification of the offline message storage duration. If not modified, the user's offline message storage duration is 7 days. The setting range is 1 to 7 days.
After the App Key enables the User-Level Function Settings feature, the client SDK supports modifying the offline message storage duration for the currently logged-in user.
Set User's Offline Message Storage Duration
Set the offline message storage duration for the current user, in days.
[[RCCoreClient sharedCoreClient] setOfflineMessageDuration:7
success:^{
} failure:^(RCErrorCode nErrorCode) {
}];
Parameter | Type | Description |
---|---|---|
duration | int | Offline message storage duration, ranging from 1 to 7 days. |
successBlock | Block | Callback for successful setting. |
errorBlock | Block | Callback for failed setting. nErrorCode returns the error code RCErrorCode. |
Get User's Offline Message Storage Duration
Starting from version 5.3.0 of RCCoreClient
, it is recommended to use the interface below that returns results asynchronously. The original synchronous interface is deprecated.
Get the offline message storage duration for the current user, in days.
[[RCCoreClient sharedCoreClient] getOfflineMessageDuration:^(int duration) {
//Success
}]