Skip to content
Simple utils for testing websocket connections.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
vendor
.drone.yml
.gitignore
Gopkg.lock
Gopkg.toml
LICENSE
Makefile
README.md
go.mod
go.sum
sample.headers
wsclient.go
wsechoserver.go

README.md

Websocket utilities

Utilities for debug websocket (RFC4655) connections. These utilities will not dig deep and will not show you internals of the protocols (use Wireshark instead). But with them you just have simple way to establish connection with your websocket server and send test messages or connect to echo server for testing your client. Currently are:

  • wsclient — allows you to establish websocket connection with websocket server and send text messages from command line.
  • wsechoserver — just reply back messages it received from websocket client.

Build Build Status

The utilities use external libraries:

github.com/gorilla/websocket
github.com/kdar/factorlog
github.com/peterh/liner

They are vendored with dep so you don't need to load anything else.

Makefile supplied for using make instead of direct call of go compiler.

make build && make install

Echo server

Run it with -verb and/or -debug args. By default it listen on localhost:48084 but you may point it to another host:port with -listen parameter.

Client

After connect to websocket server client waits for input. Any input will send to remote server. Except two special cases:

  1. If you start text with ! followed by command(s) then external command(s) will executed and its output will send to a server:

    ! ls *.txt; date

  2. If you start text with < followed by filename then this file loads and its content send to server.

    < sample.json

Any other string sequences will send as is.

Try it for example as:

wsclient -bind=echo.websocket.org
You can’t perform that action at this time.