unsetbit / p

Peer-to-peer networking with browsers
http://unsetbit.com/p
Other
411 stars 27 forks source link

IceServers for P #12

Closed AjayRah closed 9 years ago

AjayRah commented 9 years ago

Hi,

How do I pass iceservers to be used for RTCPeerConnection?

unsetbit commented 9 years ago

When you're using .connect() you can pass in a rtcConfiguration option like so:

var rtcPeer = onrampPeer.connect({
  address: '<address of peer>',
  rtcConfiguration: {
    iceServers: [
      {url: "stun:stun.l.google.com:19302"},
    ]
  }
});

The rtcConfiguration option is defined here: https://developer.mozilla.org/en-US/docs/Web/API/RTCConfiguration