diff --git a/content/chat/rooms/index.textile b/content/chat/rooms/index.textile index c56f8d8857..466bcf36c2 100644 --- a/content/chat/rooms/index.textile +++ b/content/chat/rooms/index.textile @@ -65,13 +65,8 @@ blang[react].

If the value changes between re-renders then the room will be discarded and recreated with the new options. To prevent a parent component re-render causing the @ChatRoomProvider@ to re-render, either memoize or provide a stable reference to your room options.

-blang[javascript]. - -blang[swift]. - -When you create or retrieve a room using @rooms.get()@, you need to choose which additional chat features you want enabled for that room. This is configured by passing a "@RoomOptions@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat_js.RoomOptions.html object as the second argument. In addition to setting which features are enabled, @RoomOptions@ also configures the properties of the associated features, such as the timeout period for typing indicators. - -blang[javascript]. +blang[javascript,swift]. + When you create or retrieve a room using @rooms.get()@, you need to choose which additional chat features you want enabled for that room. This is configured by passing a "@RoomOptions@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.RoomOptions.html object as the second argument. In addition to setting which features are enabled, @RoomOptions@ also configures the properties of the associated features, such as the timeout period for typing indicators. ```[javascript] const presence = {enter: false}; @@ -81,6 +76,15 @@ blang[javascript]. const room = chatClient.rooms.get('basketball-stream', {presence, reactions, typing, occupancy}); ``` + ```[swift] + let presence = PresenceOptions(enter: false) + let typing = TypingOptions(timeout: 5.0) // seconds + // using defaults for reactions and occupancy + let options = RoomOptions(presence: presence, typing: typing, reactions: nil, occupancy: nil) + let room = try await chatClient.rooms.get(roomID: "basketball-stream", options: options) + ``` + +blang[javascript]. You can also use the @RoomOptionsDefaults@ property for each @RoomOption@ to configure whether the default settings should be used: ```[javascript] @@ -92,41 +96,40 @@ blang[javascript]. ```[javascript] const room = chatClient.rooms.get('basketball-stream', {typing: {timeoutMs: 5000}}); ``` - - Enable each feature using its associated option. The details of the options available to each feature are documented on their respective pages: +blang[react,swift]. + +Enable each feature using its associated option. The details of the options available to each feature are documented on their respective pages: + +blang[javascript]. | Feature | @RoomOption@ | Default settings | | "Presence":/chat/rooms/presence | @presence@ | @RoomOptionsDefaults.presence@ | | "Occupancy":/chat/rooms/occupancy | @occupancy@ | @RoomOptionsDefaults.occupancy@ | | "Typing indicators":/chat/rooms/typing | @typing@ | @RoomOptionsDefaults.typing@ | | "Room reactions":/chat/rooms/reactions | @reactions@ | @RoomOptionsDefaults.reactions@ | -blang[react]. - blang[swift]. - - ```[swift] - let presence = PresenceOptions(enter: false) - let typing = TypingOptions(timeout: 5.0) // seconds - let options = RoomOptions(presence: presence, typing: typing, reactions: nil, occupancy: nil) - let room = try await chatClient.rooms.get(roomID: "basketball-stream", options: options) - ``` + | Feature | @RoomOption@ | Default settings | + | "Presence":/chat/rooms/presence | @presence@ | @PresenceOptions()@ | + | "Occupancy":/chat/rooms/occupancy | @occupancy@ | @OccupancyOptions()@ | + | "Typing indicators":/chat/rooms/typing | @typing@ | @TypingOptions()@ | + | "Room reactions":/chat/rooms/reactions | @reactions@ | @RoomReactionsOptions()@ | h3(#release). Release a room Releasing a room allows the underlying resources to be garbage collected or released. Releasing a room may be optional for many applications. If you have multiple transient rooms, such as in the case of a 1:1 support chat, then it is may be more beneficial. -Once "@rooms.release()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat_js.Rooms.html#release has been called, the room will be unusable and a new instance will need to be created using "@rooms.get()@":#create if you want to reuse it. -blang[javascript]. +blang[javascript,swift]. + Once "@rooms.release()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/typedoc/interfaces/chat.Rooms.html#release has been called, the room will be unusable and a new instance will need to be created using "@rooms.get()@":#create if you want to reuse it. ```[javascript] await rooms.release('basketball-stream'); ``` ```[swift] - _ = try await rooms.release(roomID: "basketball-stream") + try await rooms.release(roomID: "basketball-stream") ``` blang[react].