Skip to main content

Manage Offline Message Storage Configuration

The IM service supports modifying offline message configurations at both the application level and user level.

tip

Offline message configurations only apply to one-to-one chats and group chats. Due to their business characteristics, chatrooms and ultra groups do not support offline messages and therefore have no offline message configurations.

Understanding Offline Messages

Offline messages? refer to messages received when users are offline. The RC server automatically stores messages received during offline periods for users, with a default retention period of 7 days. If the client comes online within 7 days, the server will directly deliver the offline messages to the recipient. If the client remains offline for 7 days, the server will discard expired messages.

Not all conversation types support offline messages in the IM service:

  • Supports offline messages: One-to-one chats, group chats, system messages
  • Does not support offline messages: Chatrooms, ultra groups

Application-Level Offline Message Configuration

You can modify the following application-level offline message storage settings:

  • Offline message retention period. You can adjust the storage duration in the RC Console under Chat > Chat settings > Global Message > Offline message storage duration. Messages received by offline users will be stored as offline messages with a default 7-day retention period. These messages will be delivered upon the user's next login. The adjustable range is 1-7 days. This setting only applies to one-to-one chats, group chats, and system message conversation types.
  • Group offline message retention days. When target users are offline, received group messages will be stored as offline messages with a default 7-day retention period, available upon their next login. If not configured, the group offline message retention period follows the "Set Offline Message Retention Period" setting. If configured, group message offline retention will follow this specific setting.
  • Group offline message storage quantity. By default, all group messages within 7 days are stored. This can be modified by submitting a ticket. Configuration changes will affect all group chat conversations under the application.

User-Level Offline Message Configuration

tip

Both setting and retrieving user-level offline message retention periods require the User-Level Feature Settings to be enabled. Submit a ticket to enable this feature.

The IM service supports user-level offline message configurations, allowing only the modification of offline message retention periods. The default retention period is 7 days when unmodified, with an adjustable range of 1-7 days.

After enabling the User-Level Feature Settings for an App Key, the client SDK supports modifying the offline message retention period for the currently logged-in user.

Set User Offline Message Retention Period

Sets the offline message retention period for the current user in days.

Interface Prototype

- (void)setOfflineMessageDuration:(int)duration
success:(nullable void (^)(void))successBlock
failure:(nullable void (^)(RCErrorCode nErrorCode))errorBlock;

Parameter Description

ParameterTypeDescription
durationintOffline message retention period in days (range: 1-7).
successBlockBlockCallback for successful setting.
errorBlockBlockCallback for failed setting. nErrorCode returns error code RCErrorCode.

Example Code

[[RCCoreClient sharedCoreClient] setOfflineMessageDuration:7
success:^{

} failure:^(RCErrorCode nErrorCode) {

}];

Get User Offline Message Retention Period

tip

Starting from version 5.3.0 of RCCoreClient, it is recommended to use the asynchronous result-returning interface below, while the original synchronous interface is deprecated.

Retrieves the offline message retention period for the current user in days.

[[RCCoreClient sharedCoreClient] getOfflineMessageDuration:^(int duration) {
//Success
}];