From 40434e5d4817d0435ffe97804da8741609a0fe97 Mon Sep 17 00:00:00 2001 From: Andy Ford Date: Mon, 2 Feb 2026 20:11:10 +0000 Subject: [PATCH] Add dispose() documentation for Chat SDK Add new section documenting ChatClient.dispose() method for JavaScript, React, Swift, Kotlin, and Jetpack Compose based on: - ably/ably-chat-swift#477 - ably/ably-chat-kotlin#188 --- src/pages/docs/chat/setup.mdx | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) 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. + + +