PeerJS 设置自己的 PeerID

Sat*_*000 2 javascript peerjs

我正在尝试PeerJS并且效果很好。

只需查看演示,Peer ID 就会自动为您创建。

有没有办法定义/设置你自己的 Peer Id?

Dan*_* D. 5

创建对等对象时提供对等 ID:

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.
Run Code Online (Sandbox Code Playgroud)

这就是您在Create a peer下链接到的页面。