testWebsocketConnectivity()

testWebsocketConnectivity()

Compatibility:
Prebuilt
Custom

The testWebsocketConnectivity() method is used to determine whether your internet connection and network conditions support traffic over websockets, by identifying the AWS regions that are accessible through websockets under your current network state. This method is particularly useful during precall checks when a room has not yet been joined.

It returns a Promise that resolves to an object providing detailed information about the connectivity test results:

  • abortedRegions: An array of regions where the websocket creation attempt was aborted.
  • failedRegions: An array of regions where the websocket connection attempt failed.
  • passedRegions: An array of regions where the websocket connection attempt was successful.
  • result: Indicates the overall result of the websocket connectivity test. Possible values are "passed", "failed", "warning", or "aborted".

The result will be labeled as "passed" if you can successfully connect to all regions. If there's at least one region we can't connect to, it will return "warning", and if no region can be connected to, it will be marked as "failed". If a call to abortTestWebsocketConnectivity() occurs before all regions have completed their attempts, the result will be marked "aborted".

Also see:

Note that this check is not indicative of whether you are "allowed" to join a call (i.e. have proper credentials or a valid room) but simply a check that you can open a websocket connection between the client and server.

When should I use this?

Daily uses signaling servers to manage the participants in a given call session. These servers run in several AWS regions to minimize latency for users around the world. If you're seeing signaling issues in your application, this might be caused by a subset of participants being behind, for example, a strict corporate firewall, or a VPN. Testing their websocket connectivity allows you to proactively address potential issues before a call is actually joined.

What do I do with the results?

Getting a "warning" result does not mean your users won't be able to have a call. However, if you're running this test as part of a precall check, it is advisable to inform them they might experience issues, and they should contact their network administrator for support. You could point them to our network debugger for a more in-depth test.

Example response object:

Example usage of testWebsocketConnectivity():

Related methods and events