New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

floodsub-stream

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

floodsub-stream

libp2p-floodsub variant that delivers unique messages - the same message content will not be delivered twice

latest
Source
npmnpm
Version
0.15.6
Version published
Weekly downloads
14
133.33%
Maintainers
1
Weekly downloads
 
Created
Source

js-libp2p-floodsub

Coverage Status Travis CI Circle CI Dependency Status js-standard-style standard-readme compliant

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

Lead Maintainer

Vasco Santos.

Table of Contents

Install

> npm install libp2p-floodsub

Examples

const FloodSub = require('libp2p-floodsub')

const fsub = new FloodSub(node)

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

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

Events

Floodsub emits two kinds of events:

  • <topic> when a message is received for a particular topic
  fsub.on('fruit', (data) => { ... })
  • data: a Buffer containing the data that was published to the topic
  • floodsub:subscription-change when the local peer receives an update to the subscriptions of a remote peer.
  fsub.on('floodsub:subscription-change', (peerInfo, topics, changes) => { ... })
  • peerInfo: a PeerInfo object
  • topics: the topics that the peer is now subscribed to
  • changes: an array of { topicCID: <topic>, subscribe: <boolean> } eg [ { topicCID: 'fruit', subscribe: true }, { topicCID: 'vegetables': false } ]

API

See https://libp2p.github.io/js-libp2p-floodsub

Contribute

PRs are welcome!

Small note: If editing the Readme, please conform to the standard-readme specification.

License

MIT © David Dias

Keywords

IPFS

FAQs

Package last updated on 13 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts