peers / peerjs

Simple peer-to-peer with WebRTC.
https://peerjs.com
MIT License
12.48k stars 1.43k forks source link

incomplete information about peer IDs and metadata in docs #325

Closed teo1978 closed 5 years ago

teo1978 commented 8 years ago

At http://peerjs.com/docs/#api

In the API reference, this is said about the id parameter of the constructor:

[id]STRING Other peers can connect to this peer using the provided ID. If no ID is given, one will be generated by the brokering server. It's not recommended that you use this ID to identify peers, as it's meant to be used for brokering connections only. You're recommended to set the metadata option to send other identifying information.

You're recommended to set the metadata option: HOW? The docs of the metadata option say nothing about how you are supposed to use it to "send other identifying information" (whatever that means, which by the way is unclear too).

ndac-todoroki commented 8 years ago

Metadata is "data that provides information about other data". Wikipedia | Metadata

So I've thought anything is okay, like objects:

peer.connect(id, {
    metadata: {
        username: "ndac-todoroki",
        userid: "3cauilj1vbcsor"
    }
});

so you want to decide your own metadata key or something to identify one peer from another. But this is only how I use it...

So yes I agree with you. The documentation surely needs at least some kind of examples.