chore: update pubsub example by disabled emit self (#823)

This commit is contained in:
Vasco Santos
2020-12-04 14:53:05 +01:00
committed by Vasco Santos
parent 7d76ba1367
commit f7e1426b9e
4 changed files with 16 additions and 8 deletions

View File

@ -44,6 +44,7 @@ const createNode = async () => {
//subscribe
node1.pubsub.on(topic, (msg) => {
// Will not receive own published messages by default
console.log(`node1 received: ${uint8ArrayToString(msg.data)}`)
})
await node1.pubsub.subscribe(topic)

View File

@ -97,15 +97,12 @@ Result
```
> node 1.js
############## fruit banana ##############
node1 received: banana
node2 received: banana
node3 received: banana
############## fruit apple ##############
node1 received: apple
node2 received: apple
node3 received: apple
############## fruit car ##############
node1 received: car
############## fruit orange ##############
node1 received: orange
node2 received: orange