-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathchannels.js
More file actions
36 lines (29 loc) · 786 Bytes
/
channels.js
File metadata and controls
36 lines (29 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
var pull = require('pull-stream')
var repl = require('repl')
var ssbClient = require('ssb-client')
ssbClient(function (err, sbot) {
// open the repl session
var replServer = repl.start({})
replServer.context.sbot = sbot
// stream all messages for all keypairs.
pull(
sbot.createFeedStream({ limit: 10 }),
pull.collect(function (err, ary) {
replServer.context.allMessages = ary
})
)
// Get All channels
var filter = {
dest: `#${channel}`,
value: {
timestamp: typeof lt === 'number' ? {$lt: lt, $gt: 0} : {$gt: 0}
}
}
pull(
sbot.createFeedStream({ limit: 10 }),
pull.collect(function (err, ary) {
replServer.context.allMessages = ary
})
)
// TODO: How do you get this to return and not hang forever?
})