WebRTC on local network?

At least one machine needs to be a server, in the sense that it needs to have a port open that it listens on. This is a fact of life with all connections; when one machine opens a connection, there needs to be another machine on the other end that responds. Without this, no connections can ever be made.

If you are willing to have one or all machines listening on a port, then you can setup WebRTC on a LAN. In this case, you will not need STUN or TURN because there is no NAT traversal.

WebRTC does not need STUN or TURN on a LAN. WebRTC endpoints can generate local ICE candidates using their known addresses on the LAN. These get exchanged through signaling, either in directly in the SDP, or as ICE candidates in trickle ICE. The peer connection can be setup without ever needing to contact a STUN server external to the LAN.


Before two peers could establish direct connection, they both should exchange with a set of data (network parameters, media configuration, usable protocols, etc.), so they would figure out how to connect to each other. They can do this process with using SDP (Session Description Protocol).

Hence, you need a signaling server in the network that would be reachable by every potential peer. When a client wants to connect to the 'WebRTC network', it should first connect to the signaling server. Then, signaling server will notify other peers that we have a new one, and all peers will exchange data with SDP via the signaling server. After that, peers would be able to establish direct connection to the new peer. When direct connection is established, all data goes between peers directly.


WebRTC cannot work without some sort of signaling mechanism. Basically, your clients need to know at least something about each other, and this 'something' in the terms of WebRTC is an SDP package (Session Description Protocol). After they exchange SDP packages, WebRTC engine will try to connect clients in the most direct way.

Try this article: http://www.html5rocks.com/en/tutorials/webrtc/basics/

It will give you basic understanding of how WebRTC works, and you will answer your question yourself. Keywords: signaling, STUN and TURN.

Good luck!

Tags:

Webrtc