When does a chat session time out? - forcedotcom/ServiceSDK-iOS GitHub Wiki

There are two aspects to when a chat session times out on iOS devices.

  1. Server timeout. Timeout is determined by a value in your deployment called “Idle Connection Timeout Duration”. This server-side value determines how long the session can be idle until it times out. Since this time is counted from the last heartbeat from the client, the actual timeout can be slightly longer than the specified value. The default server timeout value is 110 seconds. (To customize this value, from Setup in your org, go to Deployments. For your deployment, check “Enable Custom Timeouts”. Adjust the value for “Idle Connection Timeout Duration”.)

  2. Client timeout. When a user puts your app in the background, Apple allows the app to perform background activity for around two minutes. During this time period, any activity in the session is passed to the user through a notification. They can return to the app and continue the session. Immediately before this time expires, the app sends a notification using the customizable string value for ServiceCloud.Chat.System.Backgrounding.Timeout.Warning. By default, this message is: Still there? Return to the app to keep your chat session open. It’s important to note that after these two minutes, the session may not actually expire (because expiration depends on the “Idle Connection Timeout Duration” value in your org). However, after two minutes, the user will no longer receive notifications based on activity in the session. Even though the user doesn’t receive notifications, they still don’t lose any information from the session. When they return to the app, the session information is updated with any new activity.

You can fine-tune the server timeout value and the client-side timeout warning message for your use case, but in general, we suggest keeping the timeout value around two minutes for the best user experience.

For more information about Chat and the Service SDK, see the Embedded Service SDK for iOS Developer Guide.