Watch for messages by all users
bash
js
sbot log --live
var pull = require('pull-stream')
pull(
sbot.createLogStream({ live: true }),
pull.drain(function (msg) { ... })
)
Watch for messages by a single user
bash
js
sbot createUserStream --id {userId} --live
var pull = require('pull-stream')
pull(
sbot.createUserStream({ id: userId, live: true }),
pull.drain(function (msg) { ... })
)
Notice that pull.drain
is used instead of pull.collect
, so that new messages are handled immediately.