chore: pubsub example subscribe returns void (#1048)

Seems like the correct return type of `Libp2p.pubsub.subscribe` is `void`, so the `await` can be removed: ae21299ade/src/pubsub-adapter.js (L29)
This commit is contained in:
Alan Smithee
2021-12-06 21:12:38 +01:00
committed by GitHub
parent b9339bccaa
commit 51dabb1724

View File

@@ -41,13 +41,13 @@ const createNode = async () => {
node1.pubsub.on(topic, (msg) => {
console.log(`node1 received: ${uint8ArrayToString(msg.data)}`)
})
await node1.pubsub.subscribe(topic)
node1.pubsub.subscribe(topic)
// Will not receive own published messages by default
node2.pubsub.on(topic, (msg) => {
console.log(`node2 received: ${uint8ArrayToString(msg.data)}`)
})
await node2.pubsub.subscribe(topic)
node2.pubsub.subscribe(topic)
// node2 publishes "news" every second
setInterval(() => {