Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Minor fixes in Transport example readme #199

Merged
merged 2 commits into from
Jun 4, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions examples/transports/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ When using libp2p, you always want to create your own libp2p Bundle, that is, pi

You will need 4 deps total, so go ahead and install all of them with:

```
```bash
> npm install libp2p libp2p-tcp peer-info async
```

Expand Down Expand Up @@ -76,7 +76,7 @@ waterfall([
})
```

Running this should result in somehting like:
Running this should result in something like:

```bash
> node 1.js
Expand All @@ -98,6 +98,12 @@ For this step, we will need one more dependency.
> npm install pull-stream
```

And we also need to import the module on our .js file:

```js
const pull = require('pull-stream')
```

We are going to reuse the MyBundle class from step 1, but this time to make things simpler, we will create two functions, one to create nodes and another to print the addrs to avoid duplicating code.

```JavaScript
Expand All @@ -118,11 +124,18 @@ function printAddrs (node, number) {
console.log('node %s is listening on:', number)
node.peerInfo.multiaddrs.forEach((ma) => console.log(ma.toString()))
}

```

Now we are going to use `async/parallel` to create two nodes, print their addresses and dial from one node to the other.
Now we are going to use `async/parallel` to create two nodes, print their addresses and dial from one node to the other. We already added `async` as a dependency, but still need to import `async/parallel`:

```js
const parallel = require('async/parallel')
```

Then,

```js
parallel([
(cb) => createNode(cb),
(cb) => createNode(cb)
Expand Down Expand Up @@ -172,7 +185,7 @@ What we are going to do in this step is to create 3 nodes, one with TCP, another

In this example, we will need to also install `libp2p-websockets`, go ahead and install:

```sh
```bash
> npm install libp2p-websockets
```

Expand Down