peer-channel

v0.1.2
create and connect to servers by name

peer-channel

create and connect to servers by name, in node or the browser.

$ npm install peer-channel

Usage

First create a server

let { createServer } = require('peer-channel')

let server = createServer(function(conn) {
  conn.on('data', function(data) {
    console.log(data.toString())
  })
  conn.send('hello from the server')
})

server.listen('abc123')

// server.close() to gracefully shut down the server

then connect to it like:

let { connect } = require('peer-channel')

let pc = connect('abc123')

pc.on('connect', function(conn) {
  conn.on('data', function(data) {
    console.log(data.toString())
  })
  conn.send('hello from the client')
})

// pc.close()
npm i peer-channel

Metadata

  • ISC
  • Whatever
  • Judd Keppel
  • released 1/15/2019

Downloads

Maintainers