Now that we have created a multifeed, each hypercore represents a different user in the application. When we replicate with another multifeed peer, we download their feeds and upload ours.
multifeed.feeds() returns a list of feeds, which are just hypercore objects (ie. they each have a createReadStream() function)..
multi.ready(function () {
const feeds = multi.feeds()
// iterate over each feed that exists locally..
feeds.forEach(function (feed) {
// feed is a hypercore! (remember reading from hypercores in previous exercises?)
// TODO: feed.createReadStream
})
// listen for new feeds that might be shared with us during runtime..
multi.on('feed', function (feed) {
// TODO: feed.createReadStream
})
})
Using console.log, write all chat messages to the screen from every hypercore in the multifeed. Have it iterate over all chat messages from all hypercores.
feed.createReadStream(options) has an option called {live: true}. If you set this, the stream will stay open and keep emitting new data as it is appended to the hypercore.multi.writer(function (err, feed) {}).Once you solve this exercise continue to exercise 10a