@discretetom/ws-server
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

ws-server

npm NPM

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

npm install -g @discretetom/ws-server

Usage

# 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

# show this help
/help
# exit
/exit
# exit
/quit

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

# send message to a specific client
@<id> <message>

# disconnect a client
!<id>

CHANGELOG

Readme

Keywords

none

Package Sidebar

Install

npm i @discretetom/ws-server

Weekly Downloads

1

Version

0.1.3

License

MIT

Unpacked Size

38.3 kB

Total Files

10

Last publish

Collaborators

  • discretetom