useNetwork(params?): Object

Returns current information about network quality and topology.

useNetwork can also be used to set up optional callbacks for daily-js network events.

Params (optional)

onNetworkQualityChangeFunctionEvent callback for the network-quality-change event
onNetworkConnectionFunctionEvent callback for the network-connection event

Return type

An object with the following properties:

getStatsFunctionDetails the latest network stats, equivalent to calling getNetworkStats()
qualitynumberA subjective calculation of the current network quality on a scale of 1-100, defaults to 100
thresholdstring'good' | 'low' | 'very-low', an assessment of the current network quality. The threshold value is calculated from network stats averaged over an approximately 30-second rolling window. By default, we lower the bandwidth used for the call when the network quality drops to 'low'; defaults to 'good'
topologystring'none' | 'peer' | 'sfu', the network connection type of the current call, defaults to 'none'

Sample code