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

Commit

Permalink
fix: missing dep and readme example (#77)
Browse files Browse the repository at this point in the history
* add missing interface-connection dependency

* rename to mplex in readme example
  • Loading branch information
Stebalien authored and daviddias committed May 12, 2018
1 parent 7587717 commit 904cd7c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ js-libp2p-mplex
Let's define a `listener.js`, which starts a TCP server on port 9999 and waits for a connection. Once we get a connection, we wait for a stream. And finally, once we have the stream, we pull the data from that stream, and printing it to the console.

```JavaScript
const multiplex = require('libp2p-multiplex')
const mplex = require('libp2p-mplex)
const tcp = require('net')
const pull = require('pull-stream')
const toPull = require('stream-to-pull-stream')
const listener = tcp.createServer((socket) => {
console.log('[listener] Got connection!')
const muxer = multiplex.listener(toPull(socket))
const muxer = mplex.listener(toPull(socket))
muxer.on('stream', (stream) => {
console.log('[listener] Got stream!')
Expand All @@ -47,14 +47,14 @@ listener.listen(9999, () => {
Now, let's define `dialer.js` who will connect to our `listener` over a TCP socket. Once we have that, we'll put a message in the stream for our `listener`.
```JavaScript
const multiplex = require('libp2p-multiplex')
const mplex = require('libp2p-mplex)
const tcp = require('net')
const pull = require('pull-stream')
const toPull = require('stream-to-pull-stream')

const socket = tcp.connect(9999)

const muxer = multiplex.dialer(toPull(socket))
const muxer = mplex.dialer(toPull(socket))

console.log('[dialer] opening stream')
const stream = muxer.newStream((err) => {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"concat-stream": "^1.6.2",
"debug": "^3.1.0",
"duplexify": "^3.5.4",
"interface-connection": "^0.3.2",
"pull-catch": "^1.0.0",
"pull-stream": "^3.6.7",
"pull-stream-to-stream": "^1.3.4",
Expand Down

0 comments on commit 904cd7c

Please sign in to comment.