simple-multi-peer

0.0.5 • Public • Published

Simple Multi Peer

WebRTC multi-peer communication made simple (using simple-peer)

Installation

$ npm install --save simple-multi-peer

Usage

As a signalling server it is recommended to use peer-hub.

var SimpleMultiPeer = require('simple-multi-peer');

var Peers = new SimpleMultiPeer({
  server: 'ws://localhost:3000', // Your signaller URL.
  room: 'foobar',                // Which 'room' you'll be using to communicate with your peers
                                 // (all peers in the same room will be signalled to each other).
  callbacks: {                   // Connection related callbacks
    connect: function() {},      // -> 2 peers are connected
    close: function() {},        // -> a connection is closed
    data: function() {},         // -> any data is received
  }
});

// Send data over a dataChannel to all peers
Peers.send('I'm alive!!!');

License

This code is released under CC0 (Public Domain)

Readme

Keywords

Package Sidebar

Install

npm i simple-multi-peer

Weekly Downloads

1

Version

0.0.5

License

CC0

Last publish

Collaborators

  • nihey