|
@@ -7,7 +7,7 @@
|
|
|
|
|
|
This class is a the BinaryJS websocket server. It is an `EventEmitter`.
|
|
|
|
|
|
-### new Peer([id], options)
|
|
|
+### new Peer([id], [options])
|
|
|
|
|
|
* `id` String. The id by which this peer will be identified when other peers try to connect to it. If no id is given, one will be generated by the server
|
|
|
* `options` Object
|
|
@@ -37,15 +37,16 @@ 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 instances of `DataConnection`.
|
|
|
|
|
|
-### peer.connect(id, [serialization], [meta])
|
|
|
+### peer.connect(id, [options])
|
|
|
|
|
|
-Connects to the remote peer specified by `id`. Optionally takes a serialization
|
|
|
-format, which can be `json`, `binary`, or `none`. Defaults to `binary`.
|
|
|
+Connects to the remote peer specified by `id`.
|
|
|
|
|
|
Returns a `DataConnection` object.
|
|
|
|
|
|
-* `id` String. The id of the remote peer to connect to
|
|
|
-* `meta` Optional metadata to pass to the remote peer. Can be any serializable type
|
|
|
+* `id` String. The id of the remote peer to connect to.
|
|
|
+* `options` Object.
|
|
|
+ * `metadata` Optional metadata to pass to the remote peer. Can be any serializable type.
|
|
|
+ * `serialization` String, which can be `binary`, `json`, or `none`. This will be the serialization format of all data sent over the P2P DataConnection. Defaults to `binary`.
|
|
|
|
|
|
Before writing to / data will be emitted from the `DataConnection` object that is returned, the `open` event must fire. Also the `error` event should be checked in case a connection cannot be made.
|
|
|
|