ws-testbed-clideprecated

The console runner for ws-testbed.

Usage no npm install needed!

<script type="module">
  import wsTestbedCli from 'https://cdn.skypack.dev/ws-testbed-cli';
</script>

README

NPM version Build Status Coveralls Status Dependency Status

ws-testbed-cli provides a command line interface for ws-testbed, running on Node.js.

Installation

npm install -g ws-testbed-cli

This will install the CLI globally and provides the script ws-testbed.

Running

When installed, run the command ws-testbed on the console. Without parameters, it will print the usage information and exit:

Usage:
  ws-testbed connect <url>... [options]
  ws-testbed serve <port>... [options]
  ws-testbed load [<cfgfile>] [options]
  ws-testbed -h | --help
  ws-testbed --version

Commands

"connect" command

Create outgoing connection(s) to the given URL(s).

"serve" command

Create server(s) on the given port(s).

"load" command

This command optionally loads a previously saved config file. Together with the --savecfg option this allows a setup to be restored without providing the complete command line again.

This is also the only way to restore a state if a plugin modified control values during runtime.

Options

--savecfg=CFGFILE

This will store all control values of all plugins in the given configuration file. This file can then be used later with the "load" command.

--plugins=PLUGINS

PLUGINS is a comma separated list of plugins to load. A plugin is specified with a type, a colon (':') and some parameter for the type. Example: --plugins=file:TestPlugin.js,file:OtherPlugin.js

The connect/serve commands do not provide much functionality without plugins. The power of the testbed comes with plugins, which need to be specified.

Supported Plugin Types

file

The file type will load the given file (using require()) and expects this file to export a constructor function for an object that implements the PluginExports interface from ws-testbed.

Examples

See ws-testbed-chat for a simple plugin.

License

The project is available under the terms of the New BSD License (see LICENSE file).