100ms Logo

100ms

Docs

Search docs
/

Network Quality Reports

Video/Audio conferencing is by nature a data intensive operation. The 100ms SDK attempts to stabilize connections especially if subscribe degradation is turned on in the template but it's possible for really bad connections that users will still have problems.

It can be helpful to measure a user's connection speed before joining a room in order to set expectations or decide to have them join with video off etc.

The 100ms SDK provides a way to measure the user's downlink speed in the preview screen.

⚠️ The downlink speed is measured by having the user download a file (1mb as of this writing) after the WebSocket connection is established during a preview.

The download will be continued for at most a fixed number of seconds (For example 10 seconds) and the speed during that interval is calculated. The entire file may not be downloaded if it exceeds the timeout.

DNS time is not counted in this, only throughput is measured.

Requesting/Reading a Network Quality Update in Preview

When creating an HMSConfig object to request a preview, set the captureNetworkQualityInPreview to true to measure the user's downlink network quality.

When available, the information will be returned in onPeerUpdate of the HMSPreviewListener in the update type HMSPeerUpdate.NETWORK_QUALITY_UPDATED. It can be retrieved out of the HMSPeer object's networkQuality property.

fun requestPreviewWithNetworkQuality(hmsSdk: HMSSDK, authToken : String, metadata: String) { val requestNetworkQuality = true val hmsPreviewListener = object : HMSPreviewListener { override fun onPeerUpdate(type: HMSPeerUpdate, peer: HMSPeer) { if(type == HMSPeerUpdate.NETWORK_QUALITY_UPDATED) println("NetworkQuality is ${peer.networkQuality?.downlinkQuality}") } override fun onPreview(room: HMSRoom, localTracks: Array<HMSTrack>) {} override fun onRoomUpdate(type: HMSRoomUpdate, hmsRoom: HMSRoom) {} override fun onError(error: HMSException) {} } val config = HMSConfig( "Aniket", authToken, metadata, requestNetworkQuality ) hmsSdk.preview(config, hmsPreviewListener) }

Here's the class definition of HMSNetworkQuality, which is a property on the HMSPeer.

data class HMSNetworkQuality( val downlinkQuality: Int )

Interpreting the Values

peer.networkQuality?.downlinkQuality will be a value between -1 and 5.

  • -1 -> Test timeout.
  • 0 -> Very bad network or network check failure.
  • 1 -> Poor network.
  • 2 -> Bad network.
  • 3 -> Average.
  • 4 -> Good.
  • 5 -> Best.