|
@@ -27,8 +27,16 @@ In the options, either a PeerServer Cloud `key` must be provided or `host` and `
|
|
|
|
|
|
The `config` object is passed straight into instances of `RTCPeerConnection`. For compatibility with symmetric NATs, you can provide your own TURN server. By default the STUN server provided by Google is used.
|
|
The `config` object is passed straight into instances of `RTCPeerConnection`. For compatibility with symmetric NATs, you can provide your own TURN server. By default the STUN server provided by Google is used.
|
|
|
|
|
|
|
|
+### peer.getId()
|
|
|
|
+
|
|
|
|
+The given id of this peer.
|
|
|
|
+
|
|
|
|
+If no id was specified in the constructor, this value will be `undefined` util the `open` event fires.
|
|
|
|
+
|
|
### peer.id
|
|
### peer.id
|
|
|
|
|
|
|
|
+**Deprecated. Use the getter instead.**
|
|
|
|
+
|
|
The given id of this peer.
|
|
The given id of this peer.
|
|
|
|
|
|
If no id was specified in the constructor, this value will be `undefined` util the `open` event fires.
|
|
If no id was specified in the constructor, this value will be `undefined` util the `open` event fires.
|
|
@@ -37,6 +45,8 @@ If no id was specified in the constructor, this value will be `undefined` util t
|
|
|
|
|
|
A hash of all current connections with the current peer. Keys are ids and values are hashes of label => `DataConnection` pairs.
|
|
A hash of all current connections with the current peer. Keys are ids and values are hashes of label => `DataConnection` pairs.
|
|
|
|
|
|
|
|
+**You are recommended to keep track of connections yourself rather than to manipulate this hash.**
|
|
|
|
+
|
|
### peer.connect(id, [options])
|
|
### peer.connect(id, [options])
|
|
|
|
|
|
Connects to the remote peer specified by `id`.
|
|
Connects to the remote peer specified by `id`.
|
|
@@ -64,6 +74,14 @@ Close the connection to the server, leaving all existing DataConnections intact.
|
|
|
|
|
|
**Warning: This cannot be undone; the respective peer object will no longer be able to create or receive any connections and its ID will be forfeited on the (cloud) server.**
|
|
**Warning: This cannot be undone; the respective peer object will no longer be able to create or receive any connections and its ID will be forfeited on the (cloud) server.**
|
|
|
|
|
|
|
|
+### peer.isConnected()
|
|
|
|
+
|
|
|
|
+Returns true if there is an active connection to the PeerServer.
|
|
|
|
+
|
|
|
|
+### peer.isDestroyed()
|
|
|
|
+
|
|
|
|
+Returns true if this peer is destroyed and can no longer be used.
|
|
|
|
+
|
|
### Event: 'connection'
|
|
### Event: 'connection'
|
|
|
|
|
|
`function (connection, meta) { }`
|
|
`function (connection, meta) { }`
|
|
@@ -133,7 +151,7 @@ The metadata passed in when the connection was created with `peer.connect(...)`.
|
|
|
|
|
|
### connection.getLabel()
|
|
### connection.getLabel()
|
|
|
|
|
|
-The optional label passed in when the connection was created with `peer.connect(...)`.
|
|
|
|
|
|
+The optional label passed in or assigned by PeerJS when the connection was created with `peer.connect(...)`.
|
|
|
|
|
|
|
|
|
|
### connection.peer
|
|
### connection.peer
|
|
@@ -158,7 +176,7 @@ The metadata passed in when the connection was created with `peer.connect(...)`.
|
|
|
|
|
|
**Deprecated. Use the getter instead.**
|
|
**Deprecated. Use the getter instead.**
|
|
|
|
|
|
-The optional label passed in when the connection was created with `peer.connect(...)`.
|
|
|
|
|
|
+The optional label passed in or assigned by PeerJS when the connection was created with `peer.connect(...)`.
|
|
|
|
|
|
### connection.serialization
|
|
### connection.serialization
|
|
|
|
|