0.13.0 • Published 2 years ago

libp2p-gossipsub v0.13.0

Weekly downloads
6,335
License
Apache-2.0
Repository
github
Last release
2 years ago

js-libp2p-gossipsub

npm.io 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 registrar = {
  handle: (multicodecs, handle) => {
    // register multicodec to libp2p
    // handle function is called everytime a remote peer opens a stream to the peer.
  },
  register: (multicodecs, handlers) => {
    // handlers will be used to notify pubsub of peer connection establishment or closing
  },
  unregister: (id) => {

  }
}

const gsub = new Gossipsub(peerInfo, registrar, options)

await gsub.start()

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(peerInfo, registrar, 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).

For the remaining API, see https://github.com/libp2p/js-libp2p-pubsub

Contribute

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

License

MIT © ChainSafe Systems

0.14.1

2 years ago

0.13.2

2 years ago

0.11.5

2 years ago

0.14.0

2 years ago

0.12.0

2 years ago

0.13.0

2 years ago

0.12.1

2 years ago

0.12.2

2 years ago

0.12.3

2 years ago

0.11.4

3 years ago

0.11.3

3 years ago

0.11.1

3 years ago

0.11.0

3 years ago

0.10.0

3 years ago

0.9.2

3 years ago

0.9.1

3 years ago

0.9.0

3 years ago

0.8.0

3 years ago

0.7.0

3 years ago

0.6.6

3 years ago

0.6.5

3 years ago

0.6.4

4 years ago

0.6.3

4 years ago

0.6.2

4 years ago

0.6.1

4 years ago

0.5.1

4 years ago

0.4.7

4 years ago

0.6.0

4 years ago

0.5.0

4 years ago

0.4.6

4 years ago

0.4.5

4 years ago

0.3.1

4 years ago

0.4.4

4 years ago

0.4.3

4 years ago

0.4.2

4 years ago

0.4.1

4 years ago

0.3.0

4 years ago

0.4.0

4 years ago

0.2.6

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago