WebRTC Metrics
A comprehensive overview of WebRTC statistics, derived calculations, extracted features, and observable signals, to better understand call quality, connectivity, and user experience in rtcStats
Selected candidate pair (feature)
Connection-level features describing the first selected ICE candidate pair: local and remote addresses, protocols, candidate types, and relay details.
Description
Connection-level features, extracted per RTCPeerConnection into features_connection.
These features describe the first candidate pair ICE selected (the actual network path media flowed over). They are read from the first getStats and prefixed firstCandidatePair:
…LocalAddress,…LocalProtocol(udp/tcp),…LocalNetworkType(wifi,vpn, …),…LocalType(host,srflx,relay),…LocalTypePreference.…LocalRelayProtocol,…LocalRelayUrl- set when the local candidate is a relay (which TURN server it came from).…RemoteAddress,…RemoteType.
Extracted by the open-source rtcstats-features package.
Why it matters
The selected pair answers the money question: did this call go direct, or through TURN? firstCandidatePairLocalType = 'relay' (or the remote type) means the call relayed, which costs you bandwidth and adds latency. Aggregated, these features tell you your relay rate, break it down by network type and region, and reveal which TURN server (…LocalRelayUrl) is carrying the load. …LocalNetworkType surfaces how much of your traffic is on VPNs or cellular.
Common values
…LocalType:host(direct, same network),srflx(direct via STUN),relay(through TURN).- A relay share of a few percent is normal; a high share signals restrictive networks or missing direct connectivity.
…LocalProtocol: mostlyudp; a lot oftcpsuggests UDP is being blocked.
SQL example
Relay rate by local network type, across connections that found a path:
SELECT
connection.first_candidate_pair_local_network_type AS network_type,
COUNT(*) FILTER (
WHERE connection.first_candidate_pair_local_type = 'relay' -- 'host', 'srflx' or 'relay'
OR connection.first_candidate_pair_remote_type = 'relay'
) AS relayed,
COUNT(*) AS total
FROM features_connection AS connection
WHERE connection.first_candidate_pair_local_type IS NOT NULL
AND connection.ice_connected -- only connections that found a path
GROUP BY network_type
ORDER BY total DESC;
Related features
- Configured ICE servers - what was offered, vs the pair actually chosen here.
- Geolocation - where the local, peer, and relay endpoints were.
- Connection setup time - how long finding this pair took.
- ICE-lite peer - whether the remote end of this pair is a media server.
See also
- rtcstats-server feature extraction - the full feature reference.
- How to query rtcstats-server features - includes the TURN-usage-by-country recipe.
- MDN: RTCIceCandidatePairStats