| Crates.io | wtcat |
| lib.rs | wtcat |
| version | 0.1.3 |
| created_at | 2025-12-04 22:23:53.33452+00 |
| updated_at | 2025-12-04 23:05:28.056953+00 |
| description | WebTransport CLI client for testing - like wscat for WebSocket |
| homepage | https://github.com/pervrosen/wtcat |
| repository | https://github.com/pervrosen/wtcat |
| max_upload_size | |
| id | 1967210 |
| size | 86,064 |
wtcat is a WebTransport CLI client for testing and debugging, similar to how wscat is used for WebSocket connections. It provides an easy way to connect to WebTransport servers, test authentication, and monitor real-time message streams.
jq and other toolscargo install wtcat
git clone https://github.com/pervrosen/wtcat.git
cd wtcat
cargo install --path .
wtcat --url https://localhost:4433 --no-auth -k
wtcat --url https://localhost:4433 --token "your-jwt-token" -k
wtcat --url https://localhost:4433 \
--username admin \
--password password \
--auth-url https://api.example.com/auth/login \
-k
wtcat --url https://localhost:4433 --token "token" -j -k | jq '.type'
wtcat - WebTransport CLI client for testing (like wscat for WebSocket)
Usage: wtcat [OPTIONS] --url <URL>
Options:
-u, --url <URL>
WebTransport server URL (e.g., https://localhost:4433 or https://localhost:4433/wt)
-t, --token <TOKEN>
JWT token for authentication (optional)
--username <USERNAME>
Username for authentication (requires --password and --auth-url)
-p, --password <PASSWORD>
Password for authentication (requires --username and --auth-url)
--auth-url <AUTH_URL>
Authentication endpoint URL (e.g., https://api.example.com/auth/login)
Required when using --username and --password
-s, --send <SEND>
Custom JSON payload to send on connection (e.g., '{"subscribe": "updates"}')
--no-auth
Skip authentication - connect without sending auth message
-k, --insecure
Skip TLS certificate verification (for self-signed certs)
-j, --json
Output only JSON (no decorative text, pipeable to jq)
--auth-timeout <AUTH_TIMEOUT>
Timeout for authentication response in seconds [default: 10]
-h, --help
Print help
-V, --version
Print version
wtcat --url https://localhost:4433/wt \
--token "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
--insecure
wtcat --url https://wt.example.com:4433 \
--username developer \
--password dev123 \
--auth-url https://api.example.com/auth/login
wtcat --url https://localhost:4433 \
--send '{"type":"subscribe","channel":"updates"}' \
--insecure \
--no-auth
# Extract specific fields from all messages
wtcat --url https://localhost:4433 -t $TOKEN -j -k | jq '.timestamp'
# Filter messages by type
wtcat --url https://localhost:4433 -t $TOKEN -j -k | jq 'select(.type == "price_update")'
# Pretty print specific fields
wtcat --url https://localhost:4433 -t $TOKEN -j -k | jq '{type, value, timestamp}'
# Connect to production server (with valid cert)
wtcat --url https://wt.production.com:443 --token $TOKEN
# Connect to staging (self-signed cert)
wtcat --url https://wt.staging.com:4433 --token $TOKEN -k
# Connect without any auth
wtcat --url https://test.local:4433 --no-auth -k
wtcat supports multiple authentication methods:
Provide a JWT token directly if you already have one:
wtcat --url https://localhost:4433 --token "your-jwt-token"
Let wtcat fetch a JWT token for you by authenticating against an HTTP API:
wtcat --url https://localhost:4433 \
--username admin \
--password secret \
--auth-url https://api.example.com/auth/login
The auth endpoint should:
POST requests with JSON: {"username": "...", "password": "..."}token, access_token, or jwt fieldSend a custom JSON authentication message:
wtcat --url https://localhost:4433 \
--send '{"auth_type":"bearer","credentials":"xyz123"}'
Connect without sending any authentication message:
wtcat --url https://localhost:4433 --no-auth
Use the -k or --insecure flag to skip certificate verification:
wtcat --url https://localhost:4433 -k --no-auth
⚠️ Warning: Only use --insecure for development with self-signed certificates. Never use it in production!
For production servers with CA-signed certificates, simply omit the -k flag:
wtcat --url https://wt.example.com:443 --token $TOKEN
Use -j or --json to output only JSON messages without decorative text. Perfect for piping to other tools:
# Basic JSON output
wtcat --url https://localhost:4433 -t $TOKEN -j -k
# With jq for filtering
wtcat --url https://localhost:4433 -t $TOKEN -j -k | jq '.value'
# Save to file
wtcat --url https://localhost:4433 -t $TOKEN -j -k > messages.jsonl
# Process with other tools
wtcat --url https://localhost:4433 -t $TOKEN -j -k | grep "error"
Error: Connection refused (os error 61)
Solution: Ensure the WebTransport server is running and accessible at the specified URL and port.
Error: invalid peer certificate: UnknownIssuer
Solution: Use the --insecure flag for self-signed certificates:
wtcat --url https://localhost:4433 -k --no-auth
❌ Timeout waiting for authentication response (10s)
Solutions:
--auth-timeout 30--no-auth to test basic connectivity firstError: peer doesn't support any known protocol
Solution: The server must support HTTP/3 ALPN protocol (h3). Ensure your server is configured for WebTransport/HTTP3.
wtcat uses the QUIC protocol (HTTP/3) to establish WebTransport connections:
┌─────────┐ ┌─────────┐
│ wtcat │ │ Server │
└────┬────┘ └────┬────┘
│ │
│ 1. QUIC connection (TLS 1.3) │
│──────────────────────────────────>│
│ │
│ 2. Open bidirectional stream │
│──────────────────────────────────>│
│ │
│ 3. Send auth/custom message │
│──────────────────────────────────>│
│ │
│ 4. Receive response │
│<──────────────────────────────────│
│ │
│ 5. Stream messages │
│<══════════════════════════════════│
│ (real-time updates) │
│ │
| Feature | wtcat (WebTransport) | wscat (WebSocket) |
|---|---|---|
| Protocol | QUIC/HTTP3 | TCP/HTTP1.1 or HTTP/2 |
| Encryption | TLS 1.3 (mandatory) | Optional (ws/wss) |
| Latency | Lower (0-RTT) | Higher |
| Head-of-line blocking | No | Yes |
| Multiplexing | Native | Via HTTP/2 |
| Mobile-friendly | Yes (survives IP changes) | No |
| Browser support | ~75% (2025) | ~98% |
git clone https://github.com/pervrosen/wtcat.git
cd wtcat
cargo build --release
cargo test
cargo run -- --url https://localhost:4433 --no-auth -k
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ by the Rust community