@ixds/ws-broadcast
A simple (zero config) websocket server to be run as cli or as node module
Last updated a year ago by fabian.moron.zirfas .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @ixds/ws-broadcast 
SYNC missed versions from official npm registry.

Websocket Broadcast (aka ws-broadcast)

This module provides a zero config (if you want it to) websocket server. It can be used as an CLI or as a node module.

It is based on code used throughout several prototypes we build here at IXDS.

Installation

install it like this:

npm install @ixds/ws-broadcast

Or as global cli (not recommended):

npm install -g @ixds/ws-broadcast

Usage CLI

You can run this as a CLI in package.json or as a global tool

In the shell:

ws-broadcast --help

  Usage: ws-broadcast [options]

  Options:

    -V, --version          output the version number
    -c, --config <config>  path to your config.json file
    -h, --help             output usage information

If no config file is provided it will use the default configuration.

{
    "host": "0.0.0.0",
    "port": 3334,
    "backlog": null,
    "path": null,
    "noServer": false,
    "clientTracking": true,
    "perMessageDeflate": false,
    "maxPayload": 104857600,
    "exclusiveBroadcast": false
}

For even more configuration see the api docs of websockets/ws: Simple to use, blazing fast and thoroughly tested WebSocket client and server for Node.js.

In package.json you can provide a script like this.

{
  "scripts": {
    "ws-server": "./node_modules/.bin/ws-broadcast -c \"./path/to/your/config.json\""
  }
}

Or even shorter:

{
  "scripts": {
    "ws-server": "ws-broadcast -c \"./path/to/your/config.json\""
  }
}

If the default config is fine for you it could also be:

{
  "scripts": {
    "ws-server": "ws-broadcast"
  }
}

Usage as Module

const {broadcast} = require('ws-broadcast');
const wss = broadcast();
// now do additional things with wss

With config passed to the module.

const {broadcast} = require('ws-broadcast');
const wss = broadcast({port:7777});
// now do additional things with wss

License

Icon based on broadcast by b farias from the Noun Project

MIT License

Copyright (c) 2018 IXDS

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Current Tags

  • 0.1.2                                ...           beta (2 years ago)
  • 0.1.5                                ...           latest (a year ago)

6 Versions

  • 0.1.5                                ...           a year ago
  • 0.1.4                                ...           2 years ago
  • 0.1.3                                ...           2 years ago
  • 0.1.2                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 6
This Month 6
Last Day 0
Last Week 0
Last Month 2
Dependencies (5)
Dev Dependencies (8)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |