GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - inpyjamas/ws-broadcast: A zero config websocket server as a CLI or as a module

This repository was archived by the owner on Sep 10, 2025. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

75 Commits
75 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
config
config
 
 
docs/images
docs/images
 
 
lib
lib
 
 
test
test
 
 
.editorconfig
.editorconfig
 
 
.eslintrc.js
.eslintrc.js
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
nodemon.json
nodemon.json
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
renovate.json
renovate.json
 
 

Repository files navigation

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 build at IXDS. Thanks to the contributions of:

  • Constantin Wolf
  • Fabian Opitz
  • Marten Biehl
  • Thomas Geissl

Installation

install it like this:

npm install @inpyjamas/ws-broadcast

Or as global cli (not recommended):

npm install -g @inpyjamas/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) 2021 Fabian Morón Zirfas

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.

About

A zero config websocket server as a CLI or as a module

Resources

Readme
MIT license
Activity
Custom properties

Stars

5 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.