Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    hyperswarmpublic

    hyperswarm

    Hyperswarm is an experimental mdns swarm with a shared distributed state.

    It relies heavily on multicast-dns and hyperemitter.

    Install

    npm install --save hyperswarm

    Use

    var hswarm = require('hyperswarm')
     
    // ComputerA
    var a = hswarm('superswarm')
     
    // ComputerB on the same network
    var b = hswarm('superswarm')
     
    // A little while later...
    a.setState({ volume : 5 })
    setTimeout(function() {
        b.state.get('volume') // => 5
    },100)
     
    // Computer C on the same network, even more later...
    var c = hswarm('superswarm')
    setTimeout(function() {
        c.state.get('volume') // => 5
    },100)
     
    // Cleanup
    a.close()
    b.close()
    c.close()

    Changelog

    1.1.0

    • Broadcasting availability on active interface (if none specified)

    1.0.2

    • Added missing metadata to package.json

    1.0.1

    • Fixed path to proto file when used as module
    • Change event passes changeset instead of merged state, one can always get the state

    1.0.0

    • Initial release 🎉

    enjoy.

    Keywords

    install

    npm i hyperswarm

    Downloadsweekly downloads

    4

    version

    1.1.0

    license

    BSD

    repository

    githubgithub

    last publish

    collaborators

    • avatar