codelastnight / webrtc-firebase

Realtime communication in the browser!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Realtime communication in the browser!


Languages

Language:JavaScript 64.8%Language:HTML 35.2%