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:
Nina Breznik 2023-02-06 17:43:05 +00:00 committed by GitHub
parent 131fce63d7
commit 6dfa4f32ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 1 deletions

View File

@ -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.
#### `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])`
Open the channel.
#### `const m = channel.addMessage(opts)`
Add a message. Options include:
Add/register a message type for a certain encoding. Options include:
``` js
{