You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/chat/connect.textile
+5-11Lines changed: 5 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -144,15 +144,15 @@ If a client briefly loses connection to Ably, for example when driving through a
144
144
During periods of discontinuity greater than 2 minutes then you will need to take steps to recover any missed messages, such as by calling "history":/docs/chat/rooms/history.
145
145
146
146
blang[javascript,swift,kotlin].
147
-
Each feature of the Chat SDK provides an @onDiscontinuity()@ handler to assist with this. These methods enable you to register a listener that will be notified when discontinuity occurs in that feature so that you can handle it, as needed.
147
+
The Chat SDK provides an @onDiscontinuity()@ handler exposed via the Room object to assist with this. This method enables you to register a listener that will be notified when discontinuity occurs in the room so that you can handle it, as needed.
148
148
149
149
blang[react].
150
150
Any hooks that take an optional listener to monitor their events, such as typing indicator events in the @useTyping@ hook, can also register a listener to be notified of, and handle, periods of discontinuity.
151
151
152
152
For example, for messages:
153
153
154
154
```[javascript]
155
-
const { off } = room.messages.onDiscontinuity((reason?: ErrorInfo) => {
155
+
const { off } = room.onDiscontinuity((reason: ErrorInfo) => {
156
156
// Recover from the discontinuity
157
157
});
158
158
```
@@ -173,14 +173,14 @@ const MyComponent = () => {
173
173
```
174
174
175
175
```[swift]
176
-
let subscription = room.messages.onDiscontinuity()
176
+
let subscription = room.onDiscontinuity()
177
177
for await error in subscription {
178
178
print("Recovering from the error: \(error)")
179
179
}
180
180
```
181
181
182
182
```[kotlin]
183
-
val subscription = room.messages.onDiscontinuity { reason: ErrorInfo? ->
183
+
val subscription = room.onDiscontinuity { reason: ErrorInfo ->
184
184
// Recover from the discontinuity
185
185
}
186
186
```
@@ -207,10 +207,4 @@ blang[react,swift].
207
207
blang[react].
208
208
209
209
blang[javascript,swift,kotlin].
210
-
The following discontinuity handlers are available:
The discontinuity handler is accessible via the <span lang="javascript">"Room":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Room.html#onDiscontinuity</span><span lang="swift">"Room":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/documentation/ablychat/room</span><span lang="kotlin">"Room":https://sdk.ably.com/builds/ably/ably-chat-kotlin/main/dokka/chat-android/com.ably.chat/-room/index.html</span> object.
Copy file name to clipboardExpand all lines: content/chat/getting-started/javascript.textile
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -163,7 +163,7 @@ h2(#step-5). Step 5: Show who is typing a message
163
163
164
164
Typing indicators enable you to display messages to clients when someone is currently typing. An event is emitted when someone starts typing, when they press a keystroke, and then another event is emitted after a configurable amount of time has passed without a key press.
165
165
166
-
In practice the @typing.start()@ method would be called on keypress, however for demonstration purposes we will call it and wait for the default period of time to pass for a stop event to be emitted. Using your original client, add the following lines to @getStarted()@ to subscribe to typing events and emit one, then run it with @npx ts-node index.ts@:
166
+
In practice the @typing.keystroke()@ method would be called on keypress, however for demonstration purposes we will call it and wait for the default period of time to pass for a stop event to be emitted. Using your original client, add the following lines to @getStarted()@ to subscribe to typing events and emit one, then run it with @npx ts-node index.ts@:
Copy file name to clipboardExpand all lines: content/chat/rooms/index.textile
+33-45Lines changed: 33 additions & 45 deletions
Original file line number
Diff line number
Diff line change
@@ -11,31 +11,36 @@ languages:
11
11
12
12
Rooms are used to organize and logically separate your users and chat messages into 'rooms'. They are the entry object into using chat and provide access to all other chat features, such as messages, online status and typing indicators. A room can represent a 1:1 chat between an agent and a customer, a private message between two users in a chat application, a large group conversation, or the chat section of a livestream with thousands of users.
13
13
14
-
You also control which features are enabled in a room when you create one. For instance, you might only want to utilize typing indicators in direct messages between users.
It is important to note that each room is backed by a single Ably Pub/Sub channel. You may need to be aware of this when using some integrations with Ably, such as the "Pulsar":https://ably.com/docs/integrations/streaming/pulsar#creating-pulsar-rule connectors, or if you are operating in an environment where a Chat SDK is not available.
17
+
18
+
The channel name is the same as the room ID with an appended suffix of @::$chat@ (e.g @some-room-id::$chat@). In most cases, you will not need to worry about this, as the Chat SDK handles the channel creation and management for you and capabilities can be configured at the room level.
19
+
15
20
16
21
h2(#create). Create or retrieve a room
17
22
18
-
Users send messages to a room and subscribe to the room in order to receive messages. Other features, such as indicating which users are online, or which users are typing are configured as part of a room's options.
23
+
Users send messages to a room and subscribe to the room in order to receive messages.
19
24
20
25
blang[javascript,swift,kotlin].
21
26
A @room@ is created, or an existing one is retrieved from the @rooms@ collection using the <span lang="javascript">"@rooms.get()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Rooms.html#get</span><span lang="swift">"@rooms.get()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/documentation/ablychat/rooms/get%28roomid%3Aoptions%3A%29</span><span lang="kotlin">"@rooms.get()@":https://sdk.ably.com/builds/ably/ably-chat-kotlin/main/dokka/chat-android/com.ably.chat/-rooms/get.html</span> method:
22
27
23
28
blang[react].
24
29
The "@ChatRoomProvider@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.ChatRoomProvider.html provides access to a specific chat room to all child components in the component tree.
25
30
26
-
Pass in the ID of the room to use, and select which 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 to the provider.
31
+
Pass in the ID of the room to use. If you need to provide further feature configuration, such as enabling occupancy messages, you can pass in an optional "@RoomOptions@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.RoomOptions.html object to the provider.
27
32
28
33
<aside data-type='note'>
29
34
<p>All components that utilize chat feature hooks must be children of a @ChatRoomProvider@. This includes @useRoom@, "@useMessages@":/docs/chat/rooms/messages, "@useOccupancy@":/docs/chat/rooms/occupancy, "@usePresence@":/docs/chat/rooms/presence, "@usePresenceListener@":/docs/chat/rooms/presence, "@useRoomReactions@":/docs/chat/rooms/reactions and "@useTyping@":/docs/chat/rooms/typing.</p>
val room = chatClient.rooms.get(roomId = "basketball-stream", options = RoomOptions())
68
+
val room = chatClient.rooms.get(roomId = "basketball-stream")
64
69
```
65
70
66
71
blang[react].
@@ -71,67 +76,50 @@ blang[react].
71
76
</aside>
72
77
73
78
blang[javascript,swift,kotlin].
74
-
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 <span lang="javascript">"@RoomOptions@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.RoomOptions.html</span><span lang="swift">"@RoomOptions@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/documentation/ablychat/roomoptions</span><span lang="kotlin">"@RoomOptions@":https://sdk.ably.com/builds/ably/ably-chat-kotlin/main/dokka/chat-android/com.ably.chat/-room-options/index.html</span> 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.
79
+
When you create or retrieve a room using @rooms.get()@, you can provide custom configuration for some features for that roomby passing a <span lang="javascript">"@RoomOptions@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.RoomOptions.html</span><span lang="swift">"@RoomOptions@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/documentation/ablychat/roomoptions</span><span lang="kotlin">"@RoomOptions@":https://sdk.ably.com/builds/ably/ably-chat-kotlin/main/dokka/chat-android/com.ably.chat/-room-options/index.html</span> object as the second argument. If you do not provide a @RoomOptions@ object, the default settings will be used.
Releasing a room allows the underlying resources to be garbage collected or released.
133
121
134
-
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.
122
+
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 may be more beneficial. Also, proactively disconnecting rather than waiting for the standard two-minute timeout can help reduce costs and improve performance.
135
123
136
124
blang[javascript,swift,kotlin].
137
125
Once <span lang="javascript">"@rooms.release()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Rooms.html#release</span><span lang="swift">"@rooms.release()@":https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/documentation/ablychat/rooms/release%28roomid%3A%29</span><span lang="kotlin">"@rooms.release()@":https://sdk.ably.com/builds/ably/ably-chat-kotlin/main/dokka/chat-android/com.ably.chat/-rooms/release.html</span> 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.
Copy file name to clipboardExpand all lines: content/chat/rooms/occupancy.textile
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ languages:
12
12
Occupancy enables you to view the number of users currently online in a room. This feature can be used to display user counts to highlight popular, or trending chat rooms.
13
13
14
14
<aside data-type='note'>
15
-
<p>Occupancy needs to be "enabled":/docs/chat/rooms#create when creating or retrieving a room.</p>
15
+
<p>Occupancy generates messages on any client entering/leaving a room, and so increases the number of billable messages sent in a room - as such, it is disabled by default and needs to be "enabled":/docs/chat/rooms#create when creating or retrieving a room.</p>
Copy file name to clipboardExpand all lines: content/chat/rooms/presence.textile
+2-12Lines changed: 2 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -11,10 +11,6 @@ languages:
11
11
12
12
Subscribe to the online status of room members using the presence feature. Presence enables you to show which members are currently online, indicate when a user goes offline, and have users optionally set additional information about their profile, or their current status within the application.
13
13
14
-
<aside data-type='note'>
15
-
<p>Presence needs to be "enabled":/docs/chat/rooms#create when creating or retrieving a room.</p>
Copy file name to clipboardExpand all lines: content/chat/rooms/reactions.textile
-4Lines changed: 0 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -13,10 +13,6 @@ Users can send reactions to the entire chat room to show their sentiment as to w
13
13
14
14
Room reactions are ephemeral and not stored or aggregated by Ably. The intention being that they show the overall sentiment of a room at a point in time.
15
15
16
-
<aside data-type='note'>
17
-
<p>Room reactions need to be "enabled":/docs/chat/rooms#create when creating or retrieving a room.</p>
0 commit comments