2

I am trying out PeerJS and it works great.

Just looking at the demo's the Peer ID is auto created for you.

Is there a way to define / set your own Peer Id?

Satch3000
  • 47,356
  • 86
  • 216
  • 346

1 Answers1

5

Provide a peer id when you create the peer object:

var peer = new Peer('pick-an-id', {key: 'myapikey'}); 
// You can pick your own id or omit the id if you want to get a random one from the server.

This is right off the page you linked to under Create a peer.

Dan D.
  • 73,243
  • 15
  • 104
  • 123
  • Hi..can u plz tell me how to create a destination peerid so the caller can enter it and call?? – Zammuuz Nov 28 '14 at 04:32
  • Seems like the example @dan-d mentions is taken from https://github.com/NickCis/simple-peerjs which is not the same as PeerJS mentioned in the question. – Sergei Basharov Feb 15 '22 at 09:12