When connecting browsers to each others using WebRTC, I have the setting iceTransportPolicy:'all', giving me all types of candidates from the STUN/TURN server.
However, something seems to fail in the state where these candidates are being tested for connection, as the connection forms correctly if both candidates are in same LAN, but I either need to use iceTransportPolicy:'relay'
OR NOT SEND candidates of type host/srflx
to the other party, to get the TURN
connection working. Currently in this case in my code I wait for ice to fail and then for the next connection attempt I first drop typ host
candidates from being sent to other party and after that I stop sending typ srflx
candidates to other party. When I'm sending only the typ relay
candidates to the other party the connection succeeds.
I would like the ice to work as it should, being able to form connections (over TURN) even in situations where the host and srflx candidates are useless.
OP here, I found my mistake, I wanted to sent candidates only when the connection is in a state suitable for new connection, and had forgot to have the state "checking" on that list (new, gathering, checking).