Skip to main content
Deprecated 0.68.0 testConnectionQuality(options) Prebuilt Custom
This method is deprecated. Use testCallQuality() instead.
Assesses WebRTC connection quality by connecting to Daily’s TURN servers and measuring round-trip time and packet loss over the test duration. Useful for precall checks before a room is joined. The test runs for 15 seconds by default (up to 30 seconds). The longer it runs, the more accurate the results. For in-depth network stats during a call, use getNetworkStats().
A result does not determine whether a user is allowed to join a call — it’s up to you to decide what to do with 'bad' or 'warning' results.

Parameters

videoTrack
MediaStreamTrack
required
A video track used to establish the test connection. You can obtain one from call.participants().local.tracks.video.persistentTrack after calling startCamera().
duration
number
How long to run the test in seconds. Default: 15. Maximum: 30.

Return value

Returns Promise<DailyConnectionQualityTestStats>.
result
'good' | 'warning' | 'bad' | 'failed' | 'aborted'
Overall connection quality verdict. The result is determined when any one condition is met:
  • 'good'packetLoss < 5% and maxRTT < 300ms
  • 'warning'packetLoss 5–10% or maxRTT 300–600ms
  • 'bad'packetLoss ≥ 10% or maxRTT ≥ 600ms
  • 'failed' — connection to Daily’s TURN servers could not be made
  • 'aborted' — test stopped before data gathering started (via stopTestConnectionQuality())
data
DailyConnectionQualityTestData
The raw metrics used to determine the result:
secondsElapsed
number
How long the test ran in seconds.

Example response

{
  "result": "good",
  "data": {
    "maxRTT": 0.054,
    "packetLoss": 0.0802
  },
  "secondsElapsed": 15
}

Example

await call.startCamera();
const videoTrack = call.participants().local.tracks.video.persistentTrack;

const results = await call.testConnectionQuality({ videoTrack, duration: 10 });

switch (results.result) {
  case 'aborted':
    console.log('Test aborted before data was gathered.');
    break;
  case 'failed':
    console.warn('Unable to connect to TURN servers.');
    break;
  case 'bad':
    console.warn('Poor connection. Try a different network.');
    break;
  case 'warning':
    console.warn('Connection may be unstable.');
    break;
  case 'good':
  default:
    console.log('Connection quality is good.');
}

See also