Awesome WebSocket CLient - an interactive command line client for testing websocket servers
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Morgan Bazalgette e55fcc88c2 remove dep files 2 months ago
.gitignore Initial UI 3 years ago
.travis.yml Apparently YML interprets the go version as a float, so understands goo1.1 instead of go1.10 2 years ago update changelog 1 year ago README & CONTRIBUTING 3 years ago
LICENSE Initial UI 3 years ago Fix create issue link 1 year ago
editor.go Remove double-esc to quick: closes #12 2 years ago
go.mod fix import path in go.mod 2 months ago
go.sum move to go modules 2 months ago
goreleaser.yml goreleaser should only make drafts of releases 3 years ago
json.go ed3eddef1 was supposed to have this, but it didn't. 2 years ago
main.go Remove double-esc to quick: closes #12 2 years ago
mode.go Implement ability to move in the logs 3 years ago
state.go Use correct variable for CLAWS_CONNECTION 1 year ago
websocket.go Add URL() method to WebSocket 2 years ago

claws demonstration

an Awesome WebSocket CLient


WebSockets have been on the rise for a long time, but there is no good command line client that allows to interface with websockets without having to deal with barebones interfaces. Claws aims to make testing websockets and interfacing with them easier and more pleasant.

Getting started

You can grab the latest release binary from the releases page. Simply download it, extract it, and run it in a command line.

If you have Go set up, it is easy as running the following command and making sure that $GOPATH/bin (or $GOBIN) is in your PATH. Generally, this should be pretty stable, but keep in mind that it builds on master, so it may break at any point.

go get -v -u


claws [wsURL]

wsURL is an optional websocket URL to connect to once the UI has been initialised.

Once the UI has been initialised, you will be by default in “normal mode”: green box with nothing in it. This means you are composing a message to send to the server through the websocket. By pressing Esc, followed by a letter, you can do a variety of actions explained in the following table.

Letter Meaning
i Go to insert mode (also works by pressing the Ins key).
c Create a new WebSocket connection. Will prompt for an URL. If nothing is passed, previous WebSocket URL will be used.
q Close current WebSocket connection.

Quitting is done by pressing Ctrl-C. In previous version, you could press Esc twice to exit, but we decided to remove that because some vim aficionados (myself included) may find themselves panickingly pressing esc and accidentally quitting Claws.

If you want to scroll through the logs, while in Esc mode press the arrow keys, PgUp/PgDown, Home/End. Keep in mind that pressing any of these will disable autoscroll, so new elements from the log won't be shown unless you scroll down.

When you're typing text into the field, you can browse through the history of previous text, even in previous sessions, in a bash-like fashion.

Advanced usage

There are also more actions you can activate using ESC + key, that are generally not used on a day-to-day basis.

Letter Meaning
t Toggle timestamps before messages in console.
j Toggle auto-detection of JSON in server messages and automatic tab indentation.
h View help/welcome screen with quick commands.
R Go into replace/overtype mode (can also be done by pressing Insert a couple of times).


Claws stores its configuration file in ~/.config/claws.json. You are welcome to hack it and change values to how you see fit. Here's a list of the values: obvious settings are ignored.

  • Timestamp: a timestamp with which all messages to the console should be prefixed. The defaults can be toggled using the t key in esc mode, although you can also use your own prefix, following Go's system of formatting dates. The default values are an empty string "" or "2006-01-02 15:04:05 ".
  • LastWebsocketURL: URL of the last websocket you connected to. Used when connecting using the c key without specifying an URL.
  • LastActions: 50 most recent messages you sent to the console, used for seeking through history using up and down.


Piping allows you to log the messages you send and the messages you receive, or do any kind of pre-processing before they are sent or before they are shown on the console.

Pipes are specified by the Pipe configuration variable. It defaults to null - to set it, create an array containing in the first place a command and then the arguments for it. This should be a command available in your $PATH or an absolute path.

For UNIX system, this means you can do logging effectively using tee. The most basic form of logging may look like this:

"Pipe": {
	"In": ["tee", "-a", "received_messages.log"],
	"Out": ["tee", "-a", "sent_messages.log"]

This will append to the given log files the received and sent messages. But it doesn't have to stop there! You can really create any script that may do any pre-processing you want to the messages you receive and those you send. If you intend to write a non-trivial script, here are things that might come useful to know:

  • Any non-zero exit code will show an error on the console.
  • The program should be pretty fast to run, as the message can't be shown until the processing has finished.
  • There are some environment variables which provide information on the connection:
    • CLAWS_PIPE_TYPE: The type of pipe; either in or out.
    • CLAWS_SESSION: UNIX timestamp in microseconds of when the session was started.
    • CLAWS_CONNECTION: UNIX timestamp in microseconds of when the connection was started.
    • CLAWS_WS_URL: WebSocket URL we're connected to.

The sky is the limit here, so you can really do anything you can think of. Here are some examples (feel free to add more with a PR!):


Claws is mostly feature-complete, though we have something that might interest you on our issue list. If, instead, you're interested in reporting a bug or asking for a new feature, you can create a new issue. There are no real contribution guidelines, but try to write some good Go code and use go fmt :).