3.0.0 • Published 6 years ago

@m-onz/cohort-channel v3.0.0

Weekly downloads
-
License
-
Repository
github
Last release
6 years ago

cohort-channel

Create p2p event emitter for collaborative mesh networks and sneakernets in the browser and node.js using WebRTC data channels.

Create a channel

var Cohort = require('@m-onz/cohort-channel')

var cohort = Cohort ({
  channel: 'demo-channel',
  signalhubs: [ 'http://localhost:9000' ]
})

Reliable event emitter

This is using scuttlebutt/events

cohort.on('demo', console.log)
cohort.emit('demo', 'hello!')

Local signalhub server

You need a local signalhub server for WebRTC signalling and to run the tests.

npm install signalhub -g
signalhub listen -p 9000
npm test

Events

  • peers => number of connected peers
  • peer => incoming simple-peer duplex stream
cohort.on('peers', console.log)
cohort.on('peer', console.log)

Install

npm i @m-onz/cohort-channel
3.0.0

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.0

6 years ago