Wondering what’s next for npm?Check out our public roadmap! »


    2.1.1 • Public • Published


    Gossip a set of keys via extension messages on a Hypercore

    npm install --save dat-gossip
    const datGossip = require('dat-gossip')
    // Get a hypercore from _somewhere_ which all your peers are swarming on
    const discoveryCore = getHypercore()
    // Start gossiping on it
    const gossip = datGossip(discoveryCore)
    // Add some more data to advertise in the swarm
    gossip.advertise(Buffer.from('Something'), true)
    // Listen for when new data has been discovered
    gossip.on('change', (list) => {
        console.log('Latest data', list)
    // Get an array of buffers for all known data
    // Sorted alphanumerically
    const allKnown = gossip.list()


    Ce logiciel a été créé dans le cadre du projet de plateforme virtuelle de création autochtone P2P Natakanu. Une réalisation de Wapikoni Mobile, Uhu Labos Nomades et du Bureau de l'engagement communautaire de l'université Concordia. Projet financé dans le cadre de l'Entente sur le développement culturel de Montréal conclue entre la Ville de Montréal et gouvernement du Québec.

    This software was created as part of Natakanu, a P2P indigenous platform produced by Wapikoni Mobile, Uhu Labos Nomades and the Office of Community Engagement at Concordia University. Project funded under the Montreal cultural development agreement between the city of Montreal and the government of Quebec.

    Quebec Province Logo Montreal City Logo

    How it works

    • Hold a set of all data seen before
    • When you get a new peer, send them your set
    • When a peer sends you data
      • See if they're missing any data you have (broadcast to all if you do)
      • See if they have data you're missing (track it, broadcast to all)

    This results in an eventually consistant system based on the principles of the Grow-only Set conflict-free replicated data type.

    Simply put, as new data gets advertised, everyone will eventually know about it.


    const gossip = datGossip(core, {extension='dat-gossip@1'})

    Creates a new instance of dat-gossip and starts gossiping over the core's replication streams.

    • core is a mandatory hypercore instance which will be used for gossiping with peers
    • extension is an option you can add if you wish you use a custom extension message name. You probably don't need to touch this.

    gossip.on('changed', (list))

    Event emitted whenever some new data has been found. You can use this to react to newly gossiped Dat archives and load them up.

    • list is an array of the current keys.


    Adds some more data to be tracked by the gossip.

    • data should be a Buffer instance to start gossiping with other peers. This could be your Dat archive's key


    Removes some data from the internal set. This will update other peers that you no longer wish to gossip this data.


    Sends out a broadcast of your current set of data to all connected peers.

    const list = gossip.list()

    Lists all the known bits of data that have been gossiped so far.


    npm i dat-gossip

    DownloadsWeekly Downloads






    Unpacked Size

    36.7 kB

    Total Files


    Last publish


    • avatar