Repolode
vi

vi/websocat

Command-line WebSocket client and server, like netcat, curl and socat for ws:// and wss:// connections.

Stars
8,732
Forks
334
Open issues
161
Last commit
2 months ago

What is it?

websocat is a command-line tool for working with WebSockets. It can connect to a WebSocket URL and pipe stdin and stdout to it, serve WebSocket connections on a port, and bridge WebSockets to other transports such as TCP, UNIX sockets, UDP or external programs. It is useful for quick debugging of WebSocket endpoints from a shell.

Beyond simple connections, it offers socat-style composition: messages can be converted to and from lines, Base64 encoded, compressed, sent with JSON-RPC framing, or stopped by a byte sequence. It supports TLS, custom headers, Sec-WebSocket-Protocol selection, SOCKS5 proxies, auto-reconnect, broadcast to multiple clients, and Prometheus metrics. Pre-built binaries are provided for Linux, Windows and macOS, and packages exist for FreeBSD and Homebrew.

The main v1 line is written in Rust and built with cargo. A newer v4 alpha is under development in a separate branch but is not yet considered stable.

Key features

  • 01Connects to ws:// and wss:// endpoints and pipes stdin/stdout to WebSocket messages
  • 02Serves WebSocket connections from the command line
  • 03Bridges WebSockets to TCP, UNIX sockets, UDP and external programs
  • 04Supports line-based and binary message modes, Base64 and JSON-RPC transforms
  • 05Offers TLS, custom headers, SOCKS5 proxying and auto-reconnect

Use cases

  • Debugging a WebSocket endpoint from a terminal without writing client code
  • Testing a WebSocket server by sending messages and reading replies
  • Exposing a TCP service such as SSH over a WebSocket connection
  • Driving a Chromium DevTools WebSocket endpoint from scripts

Quick start

  1. 1

    Install with Homebrew on macOS

    brew install websocat
  2. 2

    Connect to the public echo server, then type messages (Ctrl+d to quit)

    websocat ws://ws.vi-server.org/mirror

Things to know

  • Building from source with a very new Rust toolchain may fail because some v1 dependencies are old.
  • On Android, wss:// connections may fail without a manually specified certificate bundle.

In collections

Topics

FAQ

What is websocat?
Command-line WebSocket client and server, like netcat, curl and socat for ws:// and wss:// connections. websocat is a command-line tool for working with WebSockets. It can connect to a WebSocket URL and pipe stdin and stdout to it, serve WebSocket connections on a port, and bridge WebSockets to other transports such as TCP, UNIX sockets, UDP or external programs. It is useful for quick debugging of WebSocket endpoints from a shell.
Is websocat free to use? What license does it have?
websocat is open source under the MIT license. Check the license terms before using it in commercial products.
Is websocat still maintained?
Updated within 6 months. The last commit to websocat was on Aug 13, 2026.
What can I use websocat for?
Debugging a WebSocket endpoint from a terminal without writing client code Testing a WebSocket server by sending messages and reading replies Exposing a TCP service such as SSH over a WebSocket connection Driving a Chromium DevTools WebSocket endpoint from scripts
How do I install websocat?
Install with Homebrew on macOS: brew install websocat Connect to the public echo server, then type messages (Ctrl+d to quit): websocat ws://ws.vi-server.org/mirror
Where can I get websocat?
The source code and installation instructions are on GitHub: https://github.com/vi/websocat

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects