Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

update docs more

  • Loading branch information...
commit c768356a92fed2ce8f30f51dc3e1dd5a09d02808 1 parent 60adf87
@michelle michelle authored
Showing with 7 additions and 6 deletions.
  1. +7 −6 docs/api.md
View
13 docs/api.md
@@ -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.
Please sign in to comment.
Something went wrong with that request. Please try again.