diff --git a/src/pages/docs/chat/setup.mdx b/src/pages/docs/chat/setup.mdx index 2b71f96e2a..cd930aad5a 100644 --- a/src/pages/docs/chat/setup.mdx +++ b/src/pages/docs/chat/setup.mdx @@ -330,3 +330,40 @@ The `logLevel` sets the verbosity of logs that will be output by the SDK. The fo | `error` | A given operation has failed and cannot be automatically recovered. The error may threaten the continuity of operation. | | `silent` | No logging will be performed. | +## Dispose of the client + +Use the [`dispose()`](https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.ChatClient.html#dispose)[`dispose()`](https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/documentation/ablychat/chatclient/dispose%28%29)[`dispose()`](https://sdk.ably.com/builds/ably/ably-chat-kotlin/main/dokka/chat/com.ably.chat/-chat-client/dispose.html) method to release all resources associated with the chat client when you are done using it: + + +```javascript +await chatClient.dispose(); +``` + +```react +await chatClient.dispose(); +``` + +```swift +await chatClient.dispose() +``` + +```kotlin +chatClient.dispose() +``` + +```jetpack +chatClient.dispose() +``` + + +Calling `dispose()` will: +- Release all rooms managed by the client +- Clean up connection listeners and timers +- Free internal resources + +After calling `dispose()`, the client should not be used. Attempting to get a room after dispose has been called will throw an error. This method is idempotent, so calling it multiple times has no additional effect. + + +