-
Notifications
You must be signed in to change notification settings - Fork 85
If TURN server is present, STUN is superflous #234
base: master
Are you sure you want to change the base?
If TURN server is present, STUN is superflous #234
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
STUN is used to figure out if TURN is needed or not. You'll want to avoid using TCP over TURN if it is not necessary.
True. However, TURN is an extension to STUN and Browsers will happily use a TURN server to generate all possible ice candidates (including If you specify just two TURN URLs as ICE servers, then you cover all cases:
That is enough. An additional benefit is that Firefox also stops complaining about too many ice servers which might slow down the ice gathering phase. |
@basisbit is there a chance that this gets merged at some point? Do you need more information on the subject? Otherwise I'll close this PR. |
@znerol I found your argument kinda right. Thanks, |
I'm using it in production with Chromiums, Firefoxes and Safaris. |
Btw, you can also check what other applications are doing by pulling up
Also see their docs on turn. No recommendation to also add Same for matrix-org/synapse YMMV, it is for sure a good idea to try to find a way to test this before putting it in production. |
Just stumbled into this a bit late, but there seems to be a misconception here. Two different things are being mixed: ICE and STUN/TURN. ICE is a "user" meta protocol of the STUN/TURN protocols. There are two different configurations for that single reason. We need to focus on srflx vs relay candidates rather than whether a TURN instance does STUN as well. Saying that TURN is STUN capable is just the same as saying that a coturn instance (which is a TURN server) can also be used as a STUN server (which it is). If you do not set a STUN entry in the That is to say: setting servers without STUN is indeed a valid use case. I myself do that. But that's due to peer reflexive candidates, not to TURN doing STUN. Even if you set neither you'll get it working under prflx candidates given the right conditions. The reason I think the docs don't recommend that is: 1) prflx candidates didn't fully work on our side till ~second quarter of 2020 (but they now do fairly well) 2) prflx candidates don't necessarily always work depending on the server NAT and firewall rules, so probably the docs are being zealous. |
I've actually tested this. Both, Chromium and Firefox do generate srflx candidates In my case even though my BBB instances only provide one |
Oh, mea culpa for not reading the thread thoroughly. I focused on the jitsi meet example (which is a relay only example anchored on peer reflexive candidates, not server reflexive) rather than reading your PR. You're actually suggesting to include a turn:3478 UDP (which does generate srflxs and udp relays) endpoint in place of the STUN entry and the turn:443-tcp on the server rather than removing the STUN entry and keeping the current TURN pair. That works. It would be fine by me if it's guaranteed that Safari isn't borking anymore without two different set of relay-tcp turn entries configured (the turn: and turns:); which was the reason that was suggested a long ago if I remember correctly. |
I guess that is what I suggested. You can check how the section looks like after applying the patch by following this link:
Some fraction of my users do use Safari, no complaints so far. Haven't tested it systematically though. |
Cool. I'll look around and see if I can get someone to field trial this and get error rate comparisons. |
If a TURN server is available, then there is no need to supply STUN servers to the Browser. As stated on webrtc.org:
It is enough to supply one
turn:
URL (for UDP) and oneturns:
(for TCP/TLS).