Skip to content

Commit f793362

Browse files
authored
Merge pull request #189809 from glorialimicrosoft/patch-11
update the doc with the two new events for realTimeNotification connection status
2 parents d58ecc4 + 90988d2 commit f793362

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

articles/communication-services/concepts/chat/concepts.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ Some SDKs (like the JavaScript Chat SDK) support real-time notifications. This f
8383
- `chatThreadPropertiesUpdated` - when chat thread properties are updated; currently, only updating the topic for the thread is supported.
8484
- `participantsAdded` - when a user is added as a chat thread participant.
8585
- `participantsRemoved` - when an existing participant is removed from the chat thread.
86+
- `realTimeNotificationConnected` - when real time notifiation is connected.
87+
- `realTimeNotificationDisconnected` -when real time notifiation is disconnected.
8688

8789
## Push notifications
8890
To send push notifications for messages missed by your users while they were away, Communication Services provides two different ways to integrate:

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)