Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/discretetom/ws-server

A CLI tool to start a WebSocket debug server using NodeJS.
https://github.com/discretetom/ws-server

cli nodejs websocket ws wscat

Last synced: 12 days ago
JSON representation

A CLI tool to start a WebSocket debug server using NodeJS.

Awesome Lists containing this project

README

        

# ws-server

[![npm](https://img.shields.io/npm/v/@discretetom/ws-server?style=flat-square)](https://www.npmjs.com/package/@discretetom/ws-server)
![NPM](https://img.shields.io/npm/l/@discretetom/ws-server?style=flat-square)

A CLI tool to start a WebSocket debug server using NodeJS.

This is useful when you want to mock a WebSocket server to test your WebSocket client.

## Installation

```bash
npm install -g @discretetom/ws-server
```

## Usage

```bash
# ws-server --help
Options:
--help Show help [boolean]
--version Show version number [boolean]
-p, --port [number] [default: 8080]
-h, --header Show header [boolean] [default: false]
-T, --no-trim Don't trim message [boolean] [default: false]
-e, --allow-empty Allow empty message [boolean] [default: false]
-E, --echo Print message from the server [boolean] [default: false]
```

## Commands

```bash
# show this help
/help
# exit
/exit
# exit
/quit

# send message to all clients
@all
# you can omit @all

# send message to a specific client
@

# disconnect a client
!
```

## [CHANGELOG](https://github.com/DiscreteTom/ws-server/blob/main/CHANGELOG.md)