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).


Keywords
IPFS, flood, flooding, gossip, libp2p, pubsub
Licenses
Apache-2.0/MIT
Install
npm install libp2p-floodsub@0.21.1

Documentation

@libp2p/floodsub

libp2p.io IRC Discuss codecov CI

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).

Table of contents

Install

$ npm i @libp2p/floodsub

Don't use this module

This module is a naive implementation of pubsub. It broadcasts all messages to all network peers, cannot provide older messages and has no protection against bad actors.

It exists for academic purposes only, you should not use it in production.

Instead please use gossipsub - a more complete implementation which is also compatible with floodsub.

Usage

import { FloodSub } from '@libp2p/floodsub'

const fsub = new FloodSub()

await fsub.start()

fsub.addEventListener('message', (data) => {
  console.log(data)
})
fsub.subscribe('fruit')

fsub.publish('fruit', new TextEncoder().encode('banana'))

License

Licensed under either of

Contribute

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.