TURN server webrtc tcp relay

2.7k Views Asked by At

I am using coturn as my TURN server for relay in a WebRTC connection. What I want to achieve is TCP based connection and not UDP.

What I have tried : In coturn configuration, I have set no-udp and no-udp-relay to force TCP based connection only.

# Uncomment if no UDP client listener is desired.
# By default UDP client listener is always started.
#
no-udp

# Uncomment if no UDP relay endpoints are allowed.
# By default UDP relay endpoints are enabled (like in RFC 5766).
#
no-udp-relay

Whenevere, I try to establish a connection, I get turn server may be broken.

Possibly useful detail, A and B are trying to communicate

  • on machine A, I get 3 UDP candidates and 3 TCP candidates
  • on machine B, I get 3 UDP candidates only.
  • both are using Firefox When I was reading firefox documentation, I see that TCP ice candidates type do not have any relay or TURN connection. Could this be a reason for failure ?

The question is, what could be the reason for failure ?

Edit : Here is latest issue from Chromium page https://bugs.chromium.org/p/chromium/issues/detail?id=1201700#c5

1

There are 1 best solutions below

1
On BEST ANSWER

Even if a TURN extension exists to obtain a TCP allocation, WebRTC does not support TURN TCP relaying, only UDP. However, it supports connecting the TURN server with TCP or TLS.

This reason is that the TURN server is assumed to be on an unrestricted network with working UDP connectivity. Since TCP has bad properties for real-time traffic, it should only be a last resort fallback, and in the extreme situation where both peers lack UDP connectivity, they can connect to TURN servers with TCP, the traffic between the TURN servers will still be UDP.