1.5.0 • Published 4 years ago

interactive-websocket-cli v1.5.0

Weekly downloads
5
License
GPL-3.0-or-later
Repository
github
Last release
4 years ago

Interactive Websocket Command Line Interface

npm GitHub forks GitHub Release Date github npm stars

An interactive websocket utility suite

Installation

npm i -g interactive-websocket-cli

Usage

wscli

wscli provides an interactive websocket client/server

Usage: wscli [options] [command]

Options:
  -V, --version                          output the version number
  -p, --pipe                             Pipe stdin to server and server to stdout
  -t, --tab-size <t>                     Set the tab size (default: 2)
  -i, --in <files>                       Use files as input (default: [])
  -o, --out <file>                       Output to file
  -u, --ugly                             No pretty print
  -d, --time-format <format>             Set the timestamp format (default: "YYYY/MM/DD HH:mm:ss(SSS[ms])")
  --server-config <file or JSON string>  Use a JSON object for any websocket server options
  --client-config <file or JSON string>  Use a JSON object for any websocket client options
  -h, --help                             output usage information

Commands:
  listen <port>                          Listen for websocket connections on a port
  connect <address>                      Connect to a websocket at an address

Notes: 
  * Pipe (-p) must be enabled when using file inputs (--in)
  * Specifying multiple --in(s) will chain together each the files and feed them through one at a time
  * Enabling ugly print (--ugly) will ignore --tab-size
  * Adress will be completed (ex. echo.websocket.org => ws://echo.websocket.org, 9000 => ws://localhost:9000)
  * --server-config and --client-config expect a JSON string conforming to https://github.com/websockets/ws/blob/HEAD/doc/ws.md#new-websocketaddress-protocols-options
  * --time-format strings are based off of https://momentjs.com/

As a client

Run wscli connect [host]. Once you see the !!! Connected message, press h for help, all further commands are triggered by the correct keypress.

      [s] send a message to server

As a server

Server has special arguments

Usage: wscli listen [options] <port>

Listen for websocket connections on a port

Options:
  -q, --quiet  Disable client outputs on connection (default: false)
  -h, --help   output usage information

Run wscli listen [port], press h for help

      [s] open select prompt, used to select which connections are being displayed and will receive transmit messages. comma seperated numbers
      [S] print selected clients
      [t] transmits message to selected clients
      [b] broadcasts message to all clients
      [k] close selected clients
   

wstee

wstee provides a proxy websocket for monitoring websocket connections. By default it will pipe stdio to the websocket although files can be provided as in/output

Usage: wstee [options]

Options:
  -V, --version                          output the version number
  -p, --pipe                             Pipe stdin to server and server to stdout
  -t, --tab-size <t>                     Set the tab size (default: 2)
  -i, --in <files>                       Use files as input (default: [])
  -o, --out <file>                       Output to file
  -u, --ugly                             No pretty print
  -d, --time-format <format>             Set the timestamp format (default: "YYYY/MM/DD HH:mm:ss(SSS[ms])")
  --server-config <file or JSON string>  Use a JSON object for any websocket server options
  --client-config <file or JSON string>  Use a JSON object for any websocket client options
  --connect-incoming <port or address>   Open a port to allow one client to connect (default: [])
  --connect-outgoing <port or address>   Connect to server  (default: [])
  -h, --help                             output usage information

Notes: 
  * Pipe (-p) must be enabled when using file inputs (--in)
  * Specifying multiple --in(s) will chain together each the files and feed them through one at a time
  * Enabling ugly print (--ugly) will ignore --tab-size
  * Adress will be completed (ex. echo.websocket.org => ws://echo.websocket.org, 9000 => ws://localhost:9000)
  * --server-config and --client-config expect a JSON string conforming to https://github.com/websockets/ws/blob/HEAD/doc/ws.md#new-websocketaddress-protocols-options
  * --time-format strings are based off of https://momentjs.com/

Note

When using -p, wstee will instead display the bitrate of data being transfered