Skip to content
This repository has been archived by the owner on Mar 11, 2020. It is now read-only.

Commit

Permalink
chore: apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-Authored-By: Jacob Heun <[email protected]>
  • Loading branch information
vasco-santos and jacobheun authored Sep 23, 2019
1 parent 8639867 commit b31bd23
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ new Connection({
- `<Map> conn.registry`
- `Array<Stream> conn.streams`
- `Promise<object> conn.newStream(Array<protocols>)`
- `<void> conn.removeStream(id)`
- `<Stream> conn.addStream(stream, protocol, metadata)`
- `Promise<> conn.close()`

Expand Down Expand Up @@ -159,13 +160,22 @@ The stream property contains the muxed stream, while the protocol contains the p

#### Add stream metadata

- `JavaScript` - `conn.addStream(stream, protocol, metadata)`
- `JavaScript` - `conn.addStream(stream, { protocol, ...metadata })`

Add a new stream to the connection registry.

`stream` is a muxed stream.
`protocol` is the string codec for the protocol used by the stream. Example: `/echo/1.0.0`
`metadata` is an object containing the stream metadata (such as its `tags`).
`metadata` is an object containing any additional, optional, stream metadata that you wish to track (such as its `tags`).

#### Remove a from the registry

- `JavaScript` - `conn.removeStream(id)`

Removes the stream with the given id from the connection registry.

`id` is the unique id of the stream for this connection.


#### Close connection

Expand Down

0 comments on commit b31bd23

Please sign in to comment.