Getting Started

The quickest way to get started with this library is to use the script, found in the bin/ directory. For an easy example, run the following:

python ws:// -t "hello world"

The above command will provide you with an interactive terminal to communicate with the server. This server will echo back any message you send it. You can test this WebSocket connection in your browser, without this library, by visiting the URL

The script has many additional options too, so it’s a great way to try using this library without writing any custom code. The output of python -h is seen below, showing the additional options available.

python -h
usage: [-h] [-p PROXY] [-v [VERBOSE]] [-n] [-r]
                 [-s [SUBPROTOCOLS [SUBPROTOCOLS ...]]] [-o ORIGIN]
                 [--eof-wait EOF_WAIT] [-t TEXT] [--timings]
                 [--headers HEADERS]

WebSocket Simple Dump Tool

positional arguments:
  ws_url                websocket url. ex. ws://

optional arguments:
  -h, --help            show this help message and exit
  -p PROXY, --proxy PROXY
                        proxy url. ex.
  -v [VERBOSE], --verbose [VERBOSE]
                        set verbose mode. If set to 1, show opcode. If set to
                        2, enable to trace websocket module
  -n, --nocert          Ignore invalid SSL cert
  -r, --raw             raw output
                        Set subprotocols
  -o ORIGIN, --origin ORIGIN
                        Set origin
  --eof-wait EOF_WAIT   wait time(second) after 'EOF' received.
  -t TEXT, --text TEXT  Send initial text
  --timings             Print timings in seconds
  --headers HEADERS     Set custom headers. Use ',' as separator