libp2p
    Preparing search index...

    Module @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.

    import { createLibp2p } from 'libp2p'
    import { floodsub } from '@libp2p/floodsub'

    const node = await createLibp2p({
    services: {
    pubsub: floodsub()
    }
    //... other options
    })
    await node.start()

    node.services.pubsub.subscribe('fruit')
    node.services.pubsub.addEventListener('message', (evt) => {
    console.log(evt)
    })

    node.services.pubsub.publish('fruit', new TextEncoder().encode('banana'))

    Interfaces

    FloodSubComponents
    FloodSubInit

    Variables

    multicodec

    Functions

    floodsub