Skip to content

Commit b30925f

Browse files
authored
Updated details about connectionSTate
1 parent 09a952e commit b30925f

File tree

1 file changed

+12
-8
lines changed
  • articles/communication-services/how-tos/calling-sdk/includes/install-sdk

1 file changed

+12
-8
lines changed

articles/communication-services/how-tos/calling-sdk/includes/install-sdk/install-sdk-web.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,19 @@ const callAgent = await callClient.createCallAgent(tokenCredential, {displayName
4444
const deviceManager = await callClient.getDeviceManager()
4545
```
4646

47-
### Manage ACS SDK connectivity for incoming calls
47+
### How to best manage SDK connectivity to Microsoft infrastructure
4848

49-
A `Call Agent` instance lets you start/join and manage incoming calls. Your `Call Agent` instance needs to be connected to ACS infrastructure to receive incoming calls. This connection is established when a `Call Agent` instance is created, but sometimes, for example when the network is unstable, the connection may not be set up, or it may break during the lifecycle of `Call Agent`. ACS SDK always tries to stay connected with ACS infrastructure. It keeps retrying to connect when the connection is lost.
49+
The `Call Agent` instance lets you manage calls and join or start them. Your calling SDK needes to connect to Microsoft infrastructure to get notification of incoming calls and coordinate other call details. Sometimes the connection may fail be disconnected.
5050

51-
You can check if `Call Agent` is connected to ACS infra by looking at the current value of `connectionState` property and listening to `connectionStateChanged` event from `Call Agent`.
51+
Your call `Call Agent` will be in 2 possible states:
52+
53+
**Connected** - A `Call Agent` connectionStatue value of `Connected` means the client SDK is connected and capable of receiving notifications from Microsoft infrastructure.
54+
55+
**Disconnected** - A `Call Agent` connectionStatue value of `Disconnected` means there is an issue that is preventing the SDK it from properly connecting. `Call Agent` should be re-created.
56+
- `invalidToken`: If a token expired or it's invalid `Call Agent` instance will disconnect with this error.
57+
- `connectionIssue`: If there is an issue with the client connecting to Microsoft infrascture, after many retries `Call Agent` will fail to re-connect and expose the `connectionIssue` error.
58+
59+
You can check if your local `Call Agent` is connected to Microsoft infrastrucue by inspecting the current value of `connectionState` property. During an active call you can listen to the `connectionStateChanged` event to determine if `Call Agent` changes from **Connected** to **Disconnected** state.
5260

5361
```js
5462
const connectionState = callAgentInstance.connectionState;
@@ -61,8 +69,4 @@ const connectionStateCallback = (args) => {
6169
callAgentInstance.on('connectionStateChanged', connectionStateCallback);
6270
```
6371

64-
The above example illustrates how to manage connection state, whenever connection state is:
65-
- `Connected` - `Call Agent` instance is connected and capable of receiving notification from ACS infra. For example, receiving incoming call notifications.
66-
- `Disconnected` - `Call Agent` instance is disconnected. It is a terminal state. `Call Agent` should be re-created. Users should make sure it has no network problems.
67-
-- reason `invalidToken` - if ACS token expired or it's invalid and application failed to provide new valid token. `Call Agent` instance will disconnect with this reason.
68-
-- reason `connectionIssue` - if the network is down, and after many retries `Call Agent` fails to re-connect, it will disconnect with this reason. It usually indicates client network issues and can be re-stored as soon as the connectivity issue is resolved.
72+

0 commit comments

Comments
 (0)