Does WebRTC use TCP or UDP?

This sounds like a very simple question, but I need confirmation

  • Does WebRTC use TCP or UDP as its peer transport? How do i know
  • I read that there is a reliability mode and DTLS agreement, how do they affect?
  • Is this transfer the same for both Media and DataChannel?
  • How to switch between TCP and UDP?

I ask about this because I know that browsers have a limit on the number of concurrent connections (I think they talk about TCP), and maybe the UDP connection is unlimited.

+51
udp tcp webrtc channel
Sep 19 '13 at 14:48
source share
1 answer
  • He can use any of them. By default, UDP is preferred, but depending on the firewall (s) between peer-to-peer connections, it can only connect to TCP. You can use Wireshark to capture packets and verify the use of TCP or UDP. In Chrome, you can also view information about the selected candidate ( googActiveConnection ) by going to chrome://webrtc-internals .

  • "Reliability mode" probably refers to the reliability mode of the DataChannel , which can be configured to operate in reliable or unreliable mode. DTLS refers to an optional but default method for exchanging encryption keys (another deprecation mode is SDES). Firefox only supports DTLS, so for browser interaction at the moment you need to enable it in Chrome .

  • RTCPeerConnection (media) will use TCP or UDP, while the DataChannel will use SCTP. The SCTP implementation used by Firefox is implemented on top of UDP: https://code.google.com/p/sctp-refimpl/ .

  • It is possible to filter out TCP or UDP ICE candidates before adding them using addIceCandidate . As a rule, you should not try to force the use of transport, as WebRTC will "do the right thing." The browser does not limit the number of TCP connections used by WebRTC without any restrictions on RTCPeerConnection or DataChannel (i.e. if you can have 10 PeerConnections, each of them can use TCP without any problems).

+60
Sep 19 '13 at 16:24
source share



All Articles