Skip to content

Commit 90988d2

Browse files
update ACS Chat JS quickstart with real time notifications connection status instruction
1 parent 797e050 commit 90988d2

File tree

1 file changed

+17
-1
lines changed
  • articles/communication-services/quickstarts/chat/includes

1 file changed

+17
-1
lines changed

articles/communication-services/quickstarts/chat/includes/chat-js.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,4 +351,20 @@ await chatThreadClient.removeParticipant({ communicationUserId: <PARTICIPANT_ID>
351351
await listParticipants();
352352
```
353353
Replace **PARTICIPANT_ID** with a User ID used in the previous step (<NEW_PARTICIPANT_USER_ID>).
354-
Add this code in place of the `<REMOVE PARTICIPANT FROM THREAD>` comment in **client.js**,
354+
Add this code in place of the `<REMOVE PARTICIPANT FROM THREAD>` comment in **client.js**.
355+
356+
### Subscribe to connection status of real time notifications
357+
Subscription to events `realTimeNotificationConnected` and `realTimeNotificationDisconnected` allows you to know when the connection to the call server is active.
358+
359+
```JavaScript
360+
// subscribe to realTimeNotificationConnected event
361+
chatClient.on('realTimeNotificationConnected', () => {
362+
console.log("Real time notification is now connected!");
363+
// your code here
364+
});
365+
// subscribe to realTimeNotificationDisconnected event
366+
chatClient.on('realTimeNotificationDisconnected', () => {
367+
console.log("Real time notification is now disconnected!");
368+
// your code here
369+
});
370+
```

0 commit comments

Comments
 (0)