reference
Version:
Generate documentation from JSON.
81 lines (79 loc) • 2.67 kB
JSON
[
{
"name": "Peer",
"type": "constructor",
"snippet": "var peer = new Peer([id], [options]);",
"description": "A Peer can connect to other peers and listen for connections.",
"children": [
{
"name": "id",
"optional": true,
"type": "string",
"description": "Other peers can connect to this peer using the provided ID. If no ID is given, one will be generated by the brokering server.<div class='tip'>It is 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.</div>"
},
{
"name": "options",
"optional": true,
"type": "object",
"children": [
{
"name": "key",
"type": "string",
"description": "API key for the cloud PeerServer. This is not used for servers other than <code>0.peerjs.com</code>."
},
{
"name": "host",
"type": "string",
"description": "Server host. Defaults to <code>0.peerjs.com</code>. Also accepts <code>'/'</code> to signify relative hostname."
},
{
"name": "port",
"type": "number",
"description": "Server port. Defaults to <code>80</code>."
},
{
"name": "config",
"type": "object",
"description": "Configuration hash passed to RTCPeerConnection. This hash contains the ICE servers. Defaults to <code>{ 'iceServers': [{ 'url': 'stun:stun.l.google.com:19302' }] }</code>"
},
{
"name": "debug",
"type": "number",
"description": "Prints log messages depending on the debug level passed in. Defaults to <code>0</code>.",
"children": [
{
"name": 0,
"description": "Prints no logs."
},
{
"name": 1,
"description": "Prints only errors."
},
{
"name": 2,
"description": "Prints errors and warnings."
},
{
"name": 3,
"description": "Prints all logs."
}
]
}
]
}
]
},
{
"name": "peer.connect",
"type": "method",
"snippet": "var connection = peer.connect(id, [options]);",
"description": "Does something",
"children": [
{
"name": "id",
"type": "string",
"description": "Something else"
}
]
}
]