Skip to main content
getNetworkStats() Returns a snapshot of the current network statistics, calculated from WebRTC stats. Stats in stats.latest are updated approximately every two seconds — poll this method to monitor network performance over time. If a value cannot be determined for a given interval, it is set to null. This most commonly occurs for packetLoss calculations due to the values it relies upon being missing or stale, or media not being transmitted. For instance, if you join a call with audio and video off, your bitrates will be 0 and packetLoss will be null because it is unknown.

Return value

Returns a Promise<DailyNetworkStats>:
networkState
string
Current network quality assessment: 'good', 'warning', 'bad', or 'unknown'. Calculated from send/receive packet loss, round trip time, and available outgoing bitrate, averaged over a ~30-second rolling window. In Prebuilt, Daily lowers bandwidth at 'warning' and disables the local camera at 'bad'.
networkStateReasons
string[]
Reasons for the current networkState. Possible values: 'sendPacketLoss', 'recvPacketLoss', 'roundTripTime', 'availableOutgoingBitrate'. Empty when state is 'good' or 'unknown'.
stats
DailyNetworkStatsData | {}
Network statistics. Empty object ({}) when stats are not yet available.
threshold
string
deprecated
Deprecated in 0.77.0. Use networkState instead. Was 'good', 'low', or 'very-low'.
quality
number
deprecated
Deprecated in 0.77.0. Was a subjective 1–100 quality score.
Firefox does not report send-side packet loss or jitter for audio (audioSendPacketLoss and audioSendJitter are always null), and does not provide availableOutgoingBitrate, networkRoundTripTime, or averageNetworkRoundTripTime.

Example

const { networkState, networkStateReasons, stats } = await call.getNetworkStats();

if (networkState === 'bad') {
  console.log('Poor network. Reasons:', networkStateReasons);
}

if (stats.latest) {
  console.log('Packet loss (send):', stats.latest.totalSendPacketLoss);
  console.log('Round trip time:', stats.latest.networkRoundTripTime);
}

See also