how to get tcp connection candidate from twilio stun/turn server?

1.9k views Asked by At

i am using a twilio free account and generated twilio turn servers and credentials. With these as ICEServerOptions, I am getting candidate which has only UDP connections, but I needed a TCP connection for reliable data transfer using webRTC.

Is there any way to get TCP relay/srflx connection from the twilio stun/turn servers? If yes then please let me know how?

Thanks MJ

1

There are 1 answers

3
Tsahi Levent-Levi On

As far as I am aware, Twilio by default doesn't add TURN/TCP to their configuration of Twilio Client, although they might do so in the future.

For now, you'll need to explicitly add that in, using something like the call below:

Twilio.Device.setup(token, { 
"iceServers": [ { "url": "turn:global.turn.twilio.com:443?transport=tcp" } ] 
});

That said, you should note the following:

  1. WebRTC doesn't run on a reliable connection for audio and video transmission. If what you are aiming for is real time media, then UDP is your best friend. TCP is used only as a necessary evil when firewalls block UDP
  2. Once WebRTC is able to connect its ICE candidates via UDP, it will simply stop trying and in most cases, you won't see TCP candidates connecting at all - they get lower priority because of (1)