mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-05-02 05:52:14 +00:00
docs: update pubsub example
This commit is contained in:
parent
4e01c094bc
commit
99873e877b
@ -54,11 +54,13 @@ parallel([
|
|||||||
], (err) => {
|
], (err) => {
|
||||||
if (err) { throw err }
|
if (err) { throw err }
|
||||||
|
|
||||||
node1.pubsub.on('news', (msg) => console.log(msg.from, msg.data.toString()))
|
node1.pubsub.subscribe('news',
|
||||||
node1.pubsub.subscribe('news')
|
(msg) => console.log(msg.from, msg.data.toString(),
|
||||||
|
() => {
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
node2.pubsub.publish('news', Buffer.from('Bird bird bird, bird is the word!'))
|
node2.pubsub.publish('news', Buffer.from('Bird bird bird, bird is the word!'))
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
})
|
||||||
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user