docs: update examples to 0.28.x api (#625)

* chore: update examples to 0.28 api

* chore: use libp2p-noise in examples

* chore: examples using multiaddrs property of libp2p

Co-authored-by: Jacob Heun <jacobheun@gmail.com>

* docs: update language around secio in crypto example

Co-authored-by: Jacob Heun <jacobheun@gmail.com>
This commit is contained in:
Vasco Santos
2020-05-15 15:37:47 +02:00
committed by Jacob Heun
parent 56316b8c1e
commit 0fbb59748e
30 changed files with 298 additions and 249 deletions

View File

@ -29,7 +29,9 @@ generate(otherSwarmKey)
console.log('nodes started...')
await node1.dial(node2.peerInfo)
// Add node 2 data to node1's PeerStore
node1.peerStore.addressBook.set(node2.peerId, node2.multiaddrs)
await node1.dial(node2.peerId)
node2.handle('/private', ({ stream }) => {
pipe(
@ -42,7 +44,7 @@ generate(otherSwarmKey)
)
})
const { stream } = await node1.dialProtocol(node2.peerInfo, '/private')
const { stream } = await node1.dialProtocol(node2.peerId, '/private')
await pipe(
['This message is sent on a private network'],