Skip to content
Realtime communication in the browser!
JavaScript HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
vendor
README.md
app.js
firebase-init.js
github.png
index.html

README.md

Tutorials

Tutorials used:

Other tutorials found

Definition of STUN/SERVER

A STUN/TURN server is used for NAT traversal in VoIP. Whether you're at home behind a common router, at work behind an enterprise firewall, or traveling, chances are that you will be behind a NAT which must be traversed before making calls. [source: Viagénie]

If a STUN server doesn’t work, then WebRTC will try the next server, which is why you should add several. But using more than two STUN/TURN servers slows down discovery. STUN servers are cheaper than TURN servers, which is why Google and Firefox allow anyone to access their STUN servers for free. TURN servers are harder to find for free, but they do exist. [sources: websitebeaver, Bugzilla]

Servers used in this app

simple-peer provides by default two STUN server:

config: {
  iceServers: [
    { urls: 'stun:stun.l.google.com:19302' },
    { urls: 'stun:global.stun.twilio.com:3478?transport=udp' },
  ]
}

Mozilla provides another free STUN server : {urls: 'stun:stun.services.mozilla.com'}

Viagénie provides a free TURN server:

{urls: 'turn:numb.viagenie.ca','credential': '****','username': '****'}

So my final config is as follows:

config: {
  iceServers: [
    { urls: 'stun:stun.l.google.com:19302' },
    { urls: 'stun:global.stun.twilio.com:3478?transport=udp' },
    { urls: 'stun:stun.services.mozilla.com' },
    { urls: 'turn:numb.viagenie.ca', credential: '****', username: '****' },
  ]
}

Paid service provided by Twilio:

WebRTC in real world apps:

  • Google Allo
  • Goole Duo
You can’t perform that action at this time.