I want to gather stats on the number of users having to fallback to TURN servers. Thus is there a way to find if a RTCPeerConnection is using a TURN server instead of "directly" communicating with a remote peer?
I've tried using pc.getStats() but that only gives me an object with a size property.
You want to use getSelectedCandidatePair. This will return the local/remote candidate that is being used. Each candidate will have a type host
, srflx
, prflx
or relay
. relay
means it is using TURN.
Make sure to check both candidates. It is possible that both pairs are TURN (or maybe just one)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With