Skip to content

WebSocket

Courier opens WebSocket connections through its own network stack, so you get the same timing, TLS and proxy behavior as HTTP requests.

### Prices
# @snippet ping {"type":"ping"}
WEBSOCKET wss://example.com/stream
Authorization: Bearer {{token}}
Sec-WebSocket-Protocol: prices.v1
{"type": "subscribe", "symbols": ["BTC-USD"]}
=== wait-for-server
{"type": "ping"}
> {%
client.test("price is positive", () => client.assert(response.body.price > 0));
%}
  • The request line is WEBSOCKET ws://… or wss://…. Headers follow.
  • The body holds messages to send right after connecting, listed in the Messages tab. === separates messages.
  • === wait-for-server holds the next message until the server sends something.

Click Connect or press ⌘↵. Courier opens the socket and sends the initial messages in order. The Handshake tab shows the DNS, TCP, TLS timing breakdown.

Each tab has its own connection. A dot marks tabs that are connected.

The composer sends text, JSON or binary (written as base64). {{variables}} work in messages, and ⌘↵ sends.

  • Snippets saves a message into the file as # @snippet name text so you can send it again later.
  • Close with code… closes the connection with a custom close code and reason.

The log shows every message with its direction, time and size, plus pings, reconnects and close codes.

  • Filter the log, pause autoscroll, copy it, or export it as .jsonl.
  • Click a message to see it in full: foldable JSON, or a hex dump for binary.
  • Edit & resend puts a message back into the composer.

The > {% %} response handler runs for every text message received, with response.body set to the message. See Scripts.

Settings → Requests has a keep-alive ping interval and auto-reconnect. See Settings.

Socket.IO and STOMP framing, and GraphQL subscriptions, aren’t supported.