Skip to content
JavaScript implementation of Gossipsub
JavaScript
Branch: master
Clone or download
Latest commit c03a087 Jul 30, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github add stale bot Jul 5, 2019
benchmarks Fix up benchmark Jun 4, 2019
src chore: update dependencies Jul 26, 2019
test chore: update dependencies Jul 26, 2019
.gitattributes Added .gitattributes Mar 13, 2019
.gitignore Clean up packages version / lock Apr 17, 2019
.travis.yml chore: enable some browser tests May 29, 2019
CHANGELOG.md chore: release version v0.0.2 Jun 4, 2019
LICENSE change license Jun 15, 2019
README.md feat: self emit option added Jul 25, 2019
package.json Update package.json Jul 30, 2019

README.md

js-libp2p-gossipsub

Travis CI

Lead Maintainer

Cayman Nava

Table of Contents

Specs

Gossipsub is an implementation of pubsub based on meshsub and floodsub. You can read the specification here.

Install

npm install libp2p-gossipsub

Usage

const Gossipsub = require('libp2p-gossipsub')

const gsub = new Gossipsub(node)

gsub.start((err) => {
  if (err) {
    console.log('Upsy', err)
  }
  gsub.on('fruit', (data) => {
    console.log(data)
  })
  gsub.subscribe('fruit')

  gsub.publish('fruit', new Buffer('banana'))
})

API

Create a gossipsub implementation

const options = {…}
const gossipsub = new Gossipsub(libp2pNode, options)

Options is an optional object with the following key-value pairs:

  • fallbackToFloodsub: boolean identifying whether the node should fallback to the floodsub protocol, if another connecting peer does not support gossipsub (defaults to true).
  • emitSelf: boolean identifying whether the node should emit to self on publish, in the event of the topic being subscribed (defaults to false).

Contribute

This module is actively under development. Please check out the issues and submit PRs!

License

MIT © ChainSafe Systems

You can’t perform that action at this time.