
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
libp2p-gossipsub
Advanced tools
Gossipsub is an implementation of pubsub based on meshsub and floodsub. You can read the specification here.
libp2p-gossipsub
currently implements the v1.0
of the spec.
npm install libp2p-gossipsub
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'))
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).msgIdFn
: a function with signature (message) => string
defining the message id given a message, used internally to deduplicate gossip (defaults to (message) => message.from + message.seqno.toString('hex')
)messageCache
: optional, a customized MessageCache
instance, see the implementation for the interface.For the remaining API, see https://github.com/libp2p/js-libp2p-pubsub
This module is actively under development. Please check out the issues and submit PRs!
MIT © ChainSafe Systems
FAQs
A typescript implementation of gossipsub
The npm package libp2p-gossipsub receives a total of 857 weekly downloads. As such, libp2p-gossipsub popularity was classified as not popular.
We found that libp2p-gossipsub demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.