|
1 |
| -# js-libp2p-pubsub-gossip |
| 1 | +js-libp2p-floodsub |
| 2 | +================== |
2 | 3 |
|
3 | 4 | [](http://ipn.io)
|
4 | 5 | [](http://libp2p.io/)
|
5 | 6 | [](http://webchat.freenode.net/?channels=%23ipfs)
|
6 |
| -[](https://coveralls.io/github/libp2p/js-libp2p-pubsub-gossip?branch=master) |
7 |
| -[](https://travis-ci.org/libp2p/js-libp2p-pubsub-gossip) |
8 |
| -[](https://circleci.com/gh/libp2p/js-libp2p-pubsub-gossip) |
9 |
| -[](https://david-dm.org/libp2p/js-libp2p-pubsub-gossip) [](https://github.com/feross/standard) |
| 7 | +[](https://coveralls.io/github/libp2p/js-libp2p-floodsub?branch=master) |
| 8 | +[](https://travis-ci.org/libp2p/js-libp2p-floodsub) |
| 9 | +[](https://circleci.com/gh/libp2p/js-libp2p-floodsub) |
| 10 | +[](https://david-dm.org/libp2p/js-libp2p-floodsub) [](https://github.com/feross/standard) |
10 | 11 | [](https://github.com/RichardLitt/standard-readme)
|
11 |
| -[](https://waffle.io/libp2p/js-libp2p-pubsub-gossip) |
| 12 | +[](https://waffle.io/libp2p/js-libp2p-floodsub) |
12 | 13 |
|
13 |
| -> libp2p-pubsub-gossip, also known as pubsub-flood or just dumbsub, this implementation of pubsub focused on delivering an API for Publish/Subscribe, but with no CastTree Forming (it just floods the network). |
| 14 | +> libp2p-floodsub, also known as pubsub-flood or just dumbsub, this implementation of pubsub focused on delivering an API for Publish/Subscribe, but with no CastTree Forming (it just floods the network). |
14 | 15 |
|
15 | 16 |
|
16 | 17 | ## Table of Contents
|
|
24 | 25 | ## Install
|
25 | 26 |
|
26 | 27 | ```
|
| 28 | +```sh |
| 29 | +> npm install libp2p-floodsub |
27 | 30 | ```
|
28 | 31 |
|
29 |
| -## Usage |
| 32 | +## Examples |
30 | 33 |
|
31 |
| -``` |
| 34 | +```JavaScript |
| 35 | +const FloodSub = require('libp2p-floodsub') |
| 36 | + |
| 37 | +const fsub = new FloodSub(libp2pNodeInstance) |
| 38 | + |
| 39 | +fsub.on('fruit', (data) => { |
| 40 | + console.log(data) |
| 41 | +}) |
| 42 | +fsub.subscribe('fruit') |
| 43 | + |
| 44 | +fsub.publish('fruit', new Buffer('banana')) |
32 | 45 | ```
|
33 | 46 |
|
34 | 47 | ## API
|
35 | 48 |
|
36 |
| -## Contribute |
| 49 | +### `ps.subscribe(<topic>)` |
| 50 | + |
| 51 | +### `ps.unsubscribe(<topic>)` |
37 | 52 |
|
38 |
| -See [the contribute file](contribute.md)! |
| 53 | +### `ps.publish(<topic>, <msg>)` |
| 54 | + |
| 55 | +### `ps.on(<topic>, callback)` |
| 56 | + |
| 57 | +### `ps.getPeerSet()` |
| 58 | + |
| 59 | +### `ps.getSubscriptions()` |
| 60 | + |
| 61 | +## Contribute |
39 | 62 |
|
40 |
| -PRs accepted. |
| 63 | +PRs are welcome! |
41 | 64 |
|
42 | 65 | Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.
|
43 | 66 |
|
|
0 commit comments