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
+15-4Lines changed: 15 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,13 +22,20 @@ A connection can have any of the following statuses:
22
22
| failed | This status is entered if the SDK encounters a failure condition that it cannot recover from. This may be a fatal connection error received from the Ably service, such as an attempt to connect with an incorrect API key, or some local terminal error, such as that the token in use has expired and the SDK does not have any way to renew it. |
23
23
24
24
blang[javascript].
25
+
<<<<<<< HEAD
25
26
Use the "@current@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.ConnectionStatus.html#current property to check which status a connection is currently in:
27
+
=======
28
+
Use the "@status@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat_js.Connection.html#status property to check which status a connection is currently in:
29
+
>>>>>>> 0d6cc60d6 (chat: update room status and connection status)
26
30
27
31
blang[react].
28
32
Use the "@currentStatus@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-react.UseChatConnectionResponse.html#currentStatus property returned in the response of the "@useChatConnection@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.useChatConnection.html hook to check which status a connection is currently in:
Use the "@connection.status.onChange()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.ConnectionStatus.html#onChange method to register a listener for status change updates:
76
+
=======
77
+
Use the "@connection.onStatusChange()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat_js.Connection.html#onStatusChange method to register a listener for status change updates:
78
+
>>>>>>> 0d6cc60d6 (chat: update room status and connection status)
68
79
69
80
blang[react].
70
81
Listeners can also be registered to monitor the changes in connection status. Any hooks that take an optional listener to monitor their events, such as typing indicator events in the @useTyping@ hook, can also register a status change listener. Changing the value provided for a listener will cause the previously registered listener instance to stop receiving events. All messages will be received by exactly one listener.
71
82
72
83
```[javascript]
73
-
const { off } = chatClient.connection.status.onStatusChange((change) => console.log(change));
84
+
const { off } = chatClient.connection.onStatusChange((change) => console.log(change));
74
85
```
75
86
76
87
```[react]
@@ -93,10 +104,10 @@ blang[javascript].
93
104
off();
94
105
```
95
106
96
-
Use the "@connection.status.offAll()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.ConnectionStatus.html#offAll method to remove all connection status listeners:
107
+
Use the "@connection.offAllStatusChange()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Connection.html#offAllStatusChange method to remove all connection status listeners:
Copy file name to clipboardExpand all lines: content/chat/rooms/index.textile
+8-5Lines changed: 8 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -179,13 +179,16 @@ A room can have any of the following statuses:
179
179
| failed | An indefinite failure condition. This status is entered if an error has been received from Ably, such as an attempt to attach without the necessary access rights. |
180
180
181
181
blang[javascript].
182
-
Use the "@current@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.RoomStatus.html#current property to check which status a room is currently in:
182
+
Use the "@status@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Room.html#status property to check which status a room is currently in:
183
183
184
184
blang[react].
185
185
Use the @roomStatus@ property to view the current "@Room@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Room.html status changes. The @roomError@ property is its associated error. Any hooks that take an optional listener have these properties available in their response, such as @useMessages@ or @useTyping@. It is more common that you will monitor the room status in the specific feature hooks rather than needing to use @useRoom@. These events are related to the room instance of the nearest "@ChatRoomProvider@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.ChatRoomProvider.html. For example, with the @useMessages@ hook:
186
186
187
187
```[javascript]
188
-
const currentStatus = room.status.current
188
+
const currentStatus = room.status;
189
+
190
+
// The error related to the current room status
191
+
const currentError = room.error;
189
192
```
190
193
191
194
```[react]
@@ -210,7 +213,7 @@ const MyComponent = () => {
210
213
blang[javascript].
211
214
You can also subscribe to room status updates by registering a listener. An event will be emitted whenever the status of the room changes.
212
215
213
-
Use the "@room.status.onChange()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.RoomStatus.html#onChange method in a room to register a listener for status change updates:
216
+
Use the "@room.onStatusChange()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Room.html#onStatusChange method in a room to register a listener for status change updates:
214
217
215
218
```[javascript]
216
219
const { off } = room.onStatusChange((change) =>
@@ -223,10 +226,10 @@ blang[javascript].
223
226
off();
224
227
```
225
228
226
-
Use the "@room.status.offAll()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.RoomStatus.html#offAll method to remove all room status listeners in a room:
229
+
Use the "@room.offAllStatusChange()@":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Room.html#offAllStatusChange method to remove all room status listeners in a room:
0 commit comments