Crates.io | wurl |
lib.rs | wurl |
version | 0.1.0 |
source | src |
created_at | 2018-04-13 19:51:03.876221 |
updated_at | 2018-04-13 19:51:03.876221 |
description | WebSocket CLI for developers |
homepage | |
repository | https://github.com/esphen/wurl |
max_upload_size | |
id | 60485 |
size | 137,098 |
The WebSocket CLI for developers
WebSockets can be hard to work with due to their stateful nature. It is not really feasible to just open a websocket in a web browser like you can with a RESTful API, so tools are needed. wurl (pronounced 'whirl') is that tool.
It is a ground up rewrite of wsta. Still heavy work in progress, but usable.
USAGE:
wurl [FLAGS] [OPTIONS] <URL>
FLAGS:
-e, --echo Enables echoing of outgoing frames
-h, --help Prints help information
-i, --include Include the HTTP headers in the output
-s, --silent Supresses all output except incoming frames
-V, --version Prints version information
-v, --verbose Increments verbosity by one
OPTIONS:
-H, --header <header:value>... Adds headers to the WebSocket HTTP handshake
-C, --control-frames <type> Enables echoing of control frames [possible values: all, in, out]
ARGS:
<URL> The URL of the server to connect to
To connect to a server with wurl
, you pass it the only required parameter, a
URL of the WebSocket server.
$ wurl wss://echo.websocket.org
Connected to wss://echo.websocket.org
After this, wurl
listens to stdin and sends any lines it reads to the
server as messages. WebSocket control frames are also supported, see the
control frames section for more information about that.
If you pass the -e, --echo
flag, you will see outgoing frames as well. These
are always prefixed with >
and a space to ensure they are possible to filter
out.
You may sometimes encounter issues connecting to a server. In this case it may
be useful to see more information about the WebSocket upgrade request. In order
to do this, pass the -i
flag.
$ wurl -i wss://echo.websocket.org
WebSocket upgrade request
---
GET / HTTP/1.1
Connection: Upgrade
Host: echo.websocket.org:443
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: bIkIvw9EcchOo931ELJpOg==
Upgrade: websocket
Origin: https://echo.websocket.org
WebSocket upgrade response
---
HTTP/1.1 101 Web Socket Protocol Handshake
Connection: Upgrade
Date: Mon, 09 Apr 2018 18:00:10 GMT
Sec-WebSocket-Accept: 9j72nbYPuMMhmEpRl4xmN+YnZDI=
Server: Kaazing Gateway
Upgrade: websocket
Connected to wss://echo.websocket.org
Displaying control frames may be useful, for example to see if your server is pinging correctly.
It will be supported to send control frames to the server using commands. The currently available commands are:
/ping
- Sends a ping frame/ping <message>
- Sends a ping frame with the given message/pong
- Sends a pong frame/pong <message>
- Sends a pong frame with the given message/close <code>
- Sends a close code to the server/close <code> <msg>
- Sends a close code with a given message to the serverIf you need to send a frame which contains a leading slash like the above commands, add a leading space to escape it.
Authentication is not built in to wurl
, but setting custom headers is
possible. Use the -H
option to set as many authentication headers as you need.
For an easy way of setting an authentication header automatically, see wurl-auth.
The main wurl executable is intentionally kept tiny. Many other programs
integrate well wurl
, and some provide features you may need. Here are some
that are designed to work well with wurl
.
Feel free to add to this list if you created something cool.
First party distribution:
Third party distibution:
NOT YET PUBLISHED
$ cargo install wurl
If you are a rust programmer, it is easy to install wurl using the cargo CLI.
To update to a newer version, simply overwrite the old executable when installing.
$ cargo install --force wurl
All tagged releases on GitHub have compiled binaries attached to them.
$ docker run -it --rm --network=host esphen/wurl
If you do not have the rust toolchain installed and there is no package for your OS, you may use the docker image, which will run on all platforms that docker supports.
If you use docker, it may be an idea to add an alias to make running it through docker easy. For example:
$ alias wurl="docker run -it --rm --network=host esphen/wurl"
Would you like to maintain a package for your OS? If it is not listed above, feel free to add it to the package manager of your choice. Once you have done so, please make a pull request to add it to the list above.