update readme with mux.pair and mux.opened (#9)
* update readme with mux.pair and mux.opened * add opts to .pair, .unpair and .opened
This commit is contained in:
parent
131fce63d7
commit
6dfa4f32ca
14
README.md
14
README.md
|
@ -108,13 +108,25 @@ __NOTE__: `mux.createChannel` returns `null` if the channel should not be opened
|
||||||
|
|
||||||
If you want multiple sessions with the same `protocol` and `id`, set `unique: false` as an option.
|
If you want multiple sessions with the same `protocol` and `id`, set `unique: false` as an option.
|
||||||
|
|
||||||
|
#### `const opened = mux.opened({ protocol, id })`
|
||||||
|
|
||||||
|
Boolean that indicates if the channel is opened.
|
||||||
|
|
||||||
|
#### `mux.pair({ protocol, id }, callback)`
|
||||||
|
|
||||||
|
Register a callback to be called everytime a new channel is requested.
|
||||||
|
|
||||||
|
#### `mux.unpair({ protocol, id })`
|
||||||
|
|
||||||
|
Unregisters the pair callback.
|
||||||
|
|
||||||
#### `channel.open([handshake])`
|
#### `channel.open([handshake])`
|
||||||
|
|
||||||
Open the channel.
|
Open the channel.
|
||||||
|
|
||||||
#### `const m = channel.addMessage(opts)`
|
#### `const m = channel.addMessage(opts)`
|
||||||
|
|
||||||
Add a message. Options include:
|
Add/register a message type for a certain encoding. Options include:
|
||||||
|
|
||||||
``` js
|
``` js
|
||||||
{
|
{
|
||||||
|
|
Reference in New Issue