You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/transports/README.md
+17-4
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ When using libp2p, you always want to create your own libp2p Bundle, that is, pi
12
12
13
13
You will need 4 deps total, so go ahead and install all of them with:
14
14
15
-
```
15
+
```bash
16
16
> npm install libp2p libp2p-tcp peer-info async
17
17
```
18
18
@@ -76,7 +76,7 @@ waterfall([
76
76
})
77
77
```
78
78
79
-
Running this should result in somehting like:
79
+
Running this should result in something like:
80
80
81
81
```bash
82
82
> node 1.js
@@ -98,6 +98,12 @@ For this step, we will need one more dependency.
98
98
> npm install pull-stream
99
99
```
100
100
101
+
And we also need to import the module on our .js file:
102
+
103
+
```js
104
+
constpull=require('pull-stream')
105
+
```
106
+
101
107
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.
102
108
103
109
```JavaScript
@@ -118,11 +124,18 @@ function printAddrs (node, number) {
Now we are going to use `async/parallel` to create two nodes, print their addresses and dial from one node to the other.
130
+
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`:
124
131
132
+
```js
133
+
constparallel=require('async/parallel')
125
134
```
135
+
136
+
Then,
137
+
138
+
```js
126
139
parallel([
127
140
(cb) =>createNode(cb),
128
141
(cb) =>createNode(cb)
@@ -172,7 +185,7 @@ What we are going to do in this step is to create 3 nodes, one with TCP, another
172
185
173
186
In this example, we will need to also install `libp2p-websockets`, go ahead and install:
0 commit comments