simple-peer-bootstrap
Bootstrap connections to get into a webrtc network
simple-peer-bootstrap creates a simple way to set up the initial simple-peer connection into the network you create, allowing you to focus on things like your application.
This package ONLY handles bootstrapping a connection with a known server, everything else (like setting up more connections, data/protocol handling, etc) is left to the application.
No security features, like passwords or an extra encryption layer, are provided.
Install
npm install --save simple-peer-bootstrap
Usage
Client
Available in both the browser & node.
const bootstrap = ; const peer = bootstrap; peer;
Server
Only available in node.
const bootstrap = ; { console;} // Bootstrap endpoint in expressconst app = ;app; // Set up a stand-alone serverconst server = bootstrap;server; // Or re-use an existing serverbootstrap;
API
Main
Method | Description |
---|---|
.bootstrap(url) |
Initiates a connect request to the given url, returns a connecting simple-peer instance |
.middleware(handler) |
Returns express-compatible middleware for receiving connect requests, handing all bootstrapped simple-peer connections to the given handler |
.server([options], handler) |
Setup or re-use a server for receiving connect requests, handing all bootstrapped simple-peer connections to the given handler |
Server
The server has the following options available:
Option | Description |
---|---|
server |
The server to attach to, creates a new one if not given |