Skip to content

Commit 443a102

Browse files
authoredNov 21, 2021
docs: minor corrections to discovery-mechanisms readme (#1030)
1 parent 3bed7b4 commit 443a102

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed
 

‎examples/discovery-mechanisms/README.md

+9-4
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const node = await Libp2p.create({
5555
peerId,
5656
addresses: {
5757
listen: ['/ip4/0.0.0.0/tcp/0']
58-
}
58+
},
5959
modules: {
6060
transport: [ TCP ],
6161
streamMuxer: [ Mplex ],
@@ -117,7 +117,7 @@ const createNode = () => {
117117
return Libp2p.create({
118118
addresses: {
119119
listen: ['/ip4/0.0.0.0/tcp/0']
120-
}
120+
},
121121
modules: {
122122
transport: [ TCP ],
123123
streamMuxer: [ Mplex ],
@@ -144,8 +144,13 @@ const [node1, node2] = await Promise.all([
144144
createNode()
145145
])
146146

147-
node1.on('peer:discovery', (peer) => console.log('Discovered:', peer.id.toB58String()))
148-
node2.on('peer:discovery', (peer) => console.log('Discovered:', peer.id.toB58String()))
147+
node1.on('peer:discovery', (peer) => console.log('Discovered:', peerId.toB58String()))
148+
node2.on('peer:discovery', (peer) => console.log('Discovered:', peerId.toB58String()))
149+
150+
await Promise.all([
151+
node1.start(),
152+
node2.start()
153+
])
149154
```
150155

151156
If you run this example, you will see the other peers being discovered.

0 commit comments

Comments
 (0)
Please sign in to comment.