Files: 6a055e1be48956691b060c261266f3d9e41250d9 / tmpl / docs / advanced / watch-for-messages.md
699 bytesRaw
Watch for messages by all users
var pull = require('pull-stream')
pull(
sbot.createLogStream({ live: true }),
pull.drain(function (msg) { ... })
)
sbot log --live
Watch for messages by a single user
var pull = require('pull-stream')
pull(
sbot.createUserStream({ id: userId, live: true }),
pull.drain(function (msg) { ... })
)
sbot createUserStream --id {userId} --live
Notice that pull.drain
is used instead of pull.collect
, so that new messages are handled immediately.
Built with git-ssb-web