Skip to content
This repository was archived by the owner on Jul 21, 2023. It is now read-only.

Commit b62560e

Browse files
committed
feat(readme): complete the readme, adding reference about pull-streams
1 parent 3f58dca commit b62560e

File tree

2 files changed

+49
-2
lines changed

2 files changed

+49
-2
lines changed

README.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,52 @@
1010

1111
![](https://github.com/raw/libp2p/interface-connection/master/img/badge.png)
1212
![](https://github.com/raw/libp2p/interface-transport/master/img/badge.png)
13-
1413
> JavaScript implementation of the WebSockets module that libp2p uses and that implements the interface-transport interface
14+
15+
## Description
16+
17+
`libp2p-websockets` is the WebSockets implementation compatible with libp2p.
18+
19+
**Note:** This module uses [pull-streams](https://pull-stream.github.io) for all stream based interfaces.
20+
21+
## Example
22+
23+
```
24+
TODO
25+
```
26+
27+
## Installation
28+
29+
### npm
30+
31+
```sh
32+
> npm i libp2p-websockets
33+
```
34+
35+
## This module uses `pull-streams`
36+
37+
We expose a streaming interface based on `pull-streams`, rather then on the Node.js core streams implementation (aka Node.js streams). `pull-streams` offers us a better mechanism for error handling and flow control guarantees. If you would like to know more about what took us to make this migration, see the discussion at this [issue](https://github.com/ipfs/js-ipfs/issues/362).
38+
39+
You can learn more about pull-streams at:
40+
41+
- [The history of Node.js streams, nodebp April 2014](https://www.youtube.com/watch?v=g5ewQEuXjsQ)
42+
- [The history of streams, 2016](http://dominictarr.com/post/145135293917/history-of-streams)
43+
- [pull-streams, the simple streaming primitive](http://dominictarr.com/post/149248845122/pull-streams-pull-streams-are-a-very-simple)
44+
- [pull-streams documentation](https://pull-stream.github.io/)
45+
46+
### Converting `pull-streams` to Node.js Streams
47+
48+
If you are a Node.js streams user, you can convert a pull-stream to Node.js Stream using the module `pull-stream-to-stream`, giving you an instance of a Node.js stream that is linked to the pull-stream. Example:
49+
50+
```
51+
const pullToStream = require('pull-stream-to-stream')
52+
53+
const nodeStreamInstance = pullToStream(pullStreamInstance)
54+
// nodeStreamInstance is an instance of a Node.js Stream
55+
```
56+
57+
To learn more about his utility, visit https://pull-stream.github.io/#pull-stream-to-stream
58+
59+
## API
60+
61+
[![](https://github.com/raw/diasdavid/interface-transport/master/img/badge.png)](https://github.com/diasdavid/interface-transport)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"aegir": "^6.0.1",
4545
"chai": "^3.5.0",
4646
"gulp": "^3.9.1",
47-
"interface-transport": "^0.3.1",
47+
"interface-transport": "^0.3.3",
4848
"multiaddr": "^2.0.2",
4949
"pre-commit": "^1.1.3",
5050
"pull-goodbye": "0.0.1",

0 commit comments

Comments
 (0)