Is WebRTC really peer-to-peer protocol? Is WebRTC really peer-to-peer protocol? google-chrome google-chrome

Is WebRTC really peer-to-peer protocol?


It is a true P2P protocol in that it can establish direct server-less communication between two arbitrary parties on the internet. Once the communication is established, no 3rd party is needed.

This comes with a few caveats though:

  1. The two peers first need to find one another. This signalling step is purposefully omitted from the WebRTC specification, since the WebRTC protocol is not specific to browsers and can be used by any number of different devices in different circumstances. Each group of peers will have their own context and will require different discovery methods. You will probably also want a middleman which controls the flow of information according to some business rule.

    You could use some other P2P protocol to establish this initial signalling phase; for instance you could just broadcast UDP packets on your local subnet if the other peer is on the same subnet. You could also use carrier pigeons for your signalling; though this is likely impractical. The most practical way for this over the general internet within a browser is to use a central message broker of some kind or another.

  2. It is not always possible to establish direct connections between two arbitrary peers. Sometimes this is hindered by network topology realities, e.g. non-permissive firewalls or NAT routers. In this case it is physically impossible for the two peers to communicate in a P2P manner and a third party relay is required; this is included in the WebRTC specification in the form of a TURN server.

So, WebRTC is a full P2P protocol at heart, but it needs to work with simple networking realities which sometimes, or maybe often, requires a server's helping hand.


According to your tags (Chrome & FF), this question is focused on browsers.

If you want to initiate a call with WebRTC :

  • you will need to download your web page (the WebRTC application) from a server (it can be optional if you have already downloaded on your computer).
  • both browsers have to exchange some informations (Codecs, ICE candidates...), also known as SDP. This step is mandatory and you should use a server. But you can involve any other technology (Xaqron's comment).
  • If the browsers are behind a NAT, they need a STUN server for retrieving their public IP addresses.
  • If one of the two browsers is behind a restrictive NAT or a Firewall, you have to use a media relay also known as TURN server.

To conclude, if you want to exchange media or data with WebRTC in P2P, you should use some servers. Usually the media will be exchange in P2P, however sometimes the media will be relayed by a TURN server if one or both browsers are behind a restrictive NAT, a firewall....