git ssb

0+

dangerousbeans / ScuttlebotCookbook



Commit 22d46cec7bb0051a99f6049e805e525a8a379318

channel examples (totally not working yet)

Joran committed on 1/2/2018, 6:37:32 AM
Parent: d1d496c724b6a707adfed50adf6518ceee488d84

Files changed

README.mdchanged
channels.jsadded
README.mdView
@@ -1,16 +1,40 @@
11 # ScuttlebotCookbook
22 Recipes for how to do some important things with the scuttlebutt p2p net
33
4 +# Common Entities
5 +- Post
6 +- Pub
7 +- Vote
8 +
9 +
410 # Messages
511
12 +
13 +### Get Messages by claimed timestamp
14 +
15 +`sbot.createFeedStream()`
16 +
17 +### Get All with conditions
18 +
19 +`sbot.createLogStream()`
20 +
21 +### Filter by type
22 +
23 +`sbot.messagesByType( type: 'vote' )`
24 +
25 +### From one feed (person)
26 +
27 +
28 +# Feeds (accounts / people)
29 +
630 ### Get All
731
832 `sbot.createLogStream()`
933
1034 ### Get All with conditions
1135
12-`sbot.createLogStream()`
36 +`?`
1337
1438
1539 # Channels
1640
@@ -20,4 +44,23 @@
2044
2145 ### Get All with conditions
2246
2347 `?`
48 +
49 +
50 +# Indexes
51 +
52 +### List all indexes
53 +
54 +`?`
55 +
56 +### Create a new index
57 +
58 +`?`
59 +
60 +### select all from an index
61 +
62 +`?`
63 +
64 +### select with conditions from an index
65 +
66 +`?`
channels.jsView
@@ -1,0 +1,24 @@
1 +var ssbClient = require('ssb-client')
2 +var ssb_backlinks = require('ssb-backlinks')
3 +
4 +var pull = require('pull-stream')
5 +
6 +ssbClient(function (err, sbot) {
7 +
8 + sbot.use(ssb_backlinks)
9 +
10 + // Get all channels
11 + pull(
12 + sbot.backlinks({
13 + query: [
14 + {$filter: {
15 + dest: {$prefix: '#'}
16 + }}
17 + ]
18 + }),
19 + pull.drain(msg => {
20 + console.log(msg)
21 + })
22 + )
23 +})
24 +

Built with git-ssb-web