README.mdView |
---|
23 | 23 … | Get the channels and who is subscribed where `cb(err, data)` is called with `data` of form: |
24 | 24 … | |
|
25 | 25 … | ```js |
26 | 26 … | { |
27 | | - [ChannelName]: Set // set of FeedIds of users subscribed to that channel |
| 27 … | + [ChannelName]: [ |
| 28 … | + [FeedId, Timestamp], |
| 29 … | + [FeedId, Timestamp], |
| 30 … | + ] |
28 | 31 … | } |
29 | 32 … | ``` |
30 | 33 … | |
31 | 34 … | e.g |
32 | 35 … | |
33 | 36 … | ```js |
34 | 37 … | { |
35 | | - 'ssb-learning': Set { '@gaQw6z...', '@ye+QM09...' }, |
36 | | - 'brazil': Set { '@gaQw6z...' } |
| 38 … | + learning: [ |
| 39 … | + ['@gaQw6z...', 1518663315275], |
| 40 … | + ['@ye+QM09...', 1518663311233] |
| 41 … | + ], |
| 42 … | + brazil: [ |
| 43 … | + ['@gaQw6z...', 1518663129468], |
| 44 … | + ] |
37 | 45 … | } |
38 | 46 … | ``` |
39 | 47 … | |
40 | | -Check your [Set methods **on MDN**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) |
41 | 48 … | |
42 | | -And if you really need an Array : |
43 | | - |
44 | | -```js |
45 | | -const s = new Set () |
46 | | -set.add('mixmix') |
47 | | -set.add('soapdog') |
48 | | - |
49 | | -[...s] // => ['mixmix', 'soapdog'] |
50 | | -Array.from(s) // => ['mixmix', 'soapdog'] |
51 | | -``` |
52 | | - |
53 | | - |
54 | 49 … | ### server.channel.get(cb) |
55 | 50 … | |
56 | 51 … | Get the current state of the channel view. This will wait until the view is up to date, if necessary. |
57 | 52 … | |
58 | 53 … | `cb(err, data)` is a standard callback function where `data` is of the form: |
59 | 54 … | |
60 | | -```js |
61 | | -{ |
62 | | - [ChannelName]: Set // set of FeedIds of users subscribed to that channel |
63 | | -} |
64 | | -``` |
| 55 … | +(same as `channel.subscriptions` at the moment) |
65 | 56 … | |
66 | 57 … | ### server.channel.stream() => pull-stream source |
67 | 58 … | |
68 | 59 … | Be careful, this is a stream which provides: |