repo_description: A decentralized messaging and sharing app built on top of Secure Scuttlebutt (SSB).
repo_topics: decentralized decentralized-messaging electron javascript linux macos nodejs off-grid offline p2p scuttlebutt server social social-network ssb windows
code: const pull = require('pull-stream')
  const pullCat = require('pull-cat')
  
  module.exports = function (sbot) {
    return {
      stream: function ({ live = null, since = null } = {}) {
        const pipe = [
          pull(
            sbot.createFeedStream({ reverse: true, gt: since }),
            pull.map(msg => msg.value.author),
            pull.unique()
          )
        ]
  
        if (live) {
          pipe.push(pull.values([{ sync: true }]))
          pipe.push(pull(sbot.createFeedStream({ old: false }),
            pull.map(msg => msg.value.author)
          ))
        }
        return pullCat(pipe)
      }
    }
  }
  