0.1.1 • Published 3 years ago

hashnet-broker-simple-peer v0.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

hashnet-broker-simple-peer

Hashnet broker, setting up simple-peer connections

Usage

const Peer   = require('hashnet');
const broker = require('hashnet-broker-simple-peer');

// Create new hashnet peer
const peer = new Peer();

// Attach this broker
broker.apply(peer);

// Connect to known server
peer.addConnection('wrtc://server/bootstrap');

API

broker.apply(peer)

Integrates the broker into the given peer

broker.middleware(peer)

express middleware, attaches a listener on your server to bootstrap clients with

broker.server(peer)

returns non-listening stand-alone http server to bootstrap clients with (/bootstrap)