explaingit

vi/websocat

8,503RustAudience · developerComplexity · 2/5Setup · easy

TLDR

A command-line tool for connecting to WebSocket servers from the terminal, like netcat but for WebSockets. It can also bridge WebSocket connections to TCP ports, UNIX sockets, or the input and output of external programs.

Mindmap

mindmap
  root((websocat))
    Modes
      WebSocket client
      WebSocket server
      Broadcast relay
    Bridging
      TCP tunneling
      UNIX sockets
      Program piping
    Features
      SOCKS5 proxy
      TLS support
      Scripting use
    Installation
      Homebrew
      Cargo install
      Binary download
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Test a WebSocket API endpoint from the terminal by sending and receiving messages interactively without writing any code.

USE CASE 2

Debug a live WebSocket service by piping its messages through a logging script or processing tool.

USE CASE 3

Tunnel TCP traffic through a WebSocket connection to reach a server behind a firewall.

USE CASE 4

Create a simple broadcast WebSocket server that relays messages from any connected client to all others.

Tech stack

RustWebSocketSOCKS5

Getting it running

Difficulty · easy Time to first run · 5min
License not specified in the explanation.

In plain English

Websocat is a command-line tool for communicating over WebSocket connections. WebSockets are a protocol that keeps a persistent two-way connection open between a client and a server, commonly used for real-time features in web applications like live chat, notifications, or streaming data. Normally, WebSocket connections are managed by application code, but websocat lets you open and interact with them directly from a terminal, the way you might test plain network connections with tools like netcat or curl. The tool can act as a client connecting to an existing WebSocket server, or as a simple server that accepts incoming connections. You type messages in the terminal and they get sent over the connection, and incoming messages print to the screen. This makes it useful for quickly testing whether a WebSocket endpoint is working, debugging live services, or scripting automated interactions. Beyond basic send and receive, websocat can bridge different connection types together. For example, it can accept a plain TCP connection on one port, wrap it in a WebSocket, and forward it somewhere else, then unwrap it back to TCP at the other end. It can pipe a WebSocket connection into the standard input and output of an external program. It supports UNIX domain sockets, SOCKS5 proxies, and both unencrypted and encrypted connections. There is also a broadcast mode that relays messages from any connected client to all other connected clients. The tool is written in Rust and pre-built binaries are available for Linux, Windows, macOS, and Android. It can also be installed through standard package managers including Homebrew on macOS, pkg on FreeBSD, and cargo (the Rust package manager) from source. The README notes that building from source with very recent or very old Rust compiler versions may cause compatibility issues depending on which release you are building.

Copy-paste prompts

Prompt 1
How do I use websocat to connect to ws://localhost:8080 and send a JSON message, then see the server's response in the terminal?
Prompt 2
Show me the websocat command to forward all traffic from local TCP port 3000 through a WebSocket connection to a remote server.
Prompt 3
How do I pipe a WebSocket stream through websocat into a shell script that processes each incoming line as a separate message?
Prompt 4
How do I start a simple WebSocket echo server with websocat to test my frontend WebSocket client code locally?
Prompt 5
Can I use websocat through a SOCKS5 proxy? Show me the command to connect through the proxy to a WebSocket endpoint.
Open on GitHub → Explain another repo

← vi on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.