27

WebRTC is a peer-peer communication protocol. I wonder, is it really peer-peer if it does require a web server? For example, to create a "room" one has to create it at apprtc.appspot.com or https://hello.firefox.com/something.

2
  • The Media streaming is Peer-To-Peer(when not using a TURN server for relay, which is sometimes needed for NAT traversal). Every peer-to-peer protocol has a method of determining the peers to connect... Apr 2, 2015 at 16:01
  • You are confusing signaling with webRTC. You need to inform peers of connection information so they can directly connect, don't like the server based solution, transfer data with flash drive and WebRTC still works.
    – Xaqron
    Apr 3, 2015 at 1:18

2 Answers 2

38

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.

3
  • 1
    Right, WebRTC solves peer-to-peer transmission, not discovery. See this answer for a jsfiddle that highlights that difference by our-sourcing discovery to you (SMS, bluetooth, carrier-pigeon).
    – jib
    Apr 3, 2015 at 20:28
  • WebRTC tries to connect two peers through P2P or relay. I doubt saying WebRTC is P2P protocol at heart is correct. It implements ICE protocol which ensures connection between two peers. This connection can either be P2P or through relay server.
    – Tahlil
    Nov 16, 2021 at 7:25
  • You should have started with the "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" because usual WebRTC implementation is not really P2P.
    – Michal
    Sep 14, 2022 at 13:35
6

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....

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.