ws-bus

2.0.0 • Public • Published

ws-bus

Node PubSub Server based on WebSockets

js-standard-style

Installation

npm install ws-bus

Usage (code)

Server

const bus = require('ws-bus')

bus.createServer({port: 3000})

Client

const bus = require('ws-bus')
const client = bus.createClient('ws://localhost:3000')

client.subscribe('channel1', (message) => {
  console.log('message:', message)
})

const message = {
  hello: 'world'
}

client.publish('channel1', message);

// client.unsubscribe('channel1')

Usage (cli)

npm install ws-bus -g
PORT=3005 ws-bus

> WebSocket Bus Server
> listening on port: 3005

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i ws-bus

Weekly Downloads

1

Version

2.0.0

License

MIT

Unpacked Size

10.4 kB

Total Files

11

Last publish

Collaborators

  • zag2art
  • cray0000