Skip to content

WebSocket Sessions

SendPad has first-class WebSocket support via .ws files. Use them interactively (connect, compose, send in real time) or run scripted sessions with assertions and extraction — just like .flow files.

  1. Open a .ws file
  2. Press ⌘Enter to connect
  3. The Session Panel shows the message timeline in real time
  4. Type in the compose bar and press Enter to send

Connections persist when you switch files — incoming messages buffer in the background. The header badge shows active connection count.

Press ⌘⇧Enter to run all ### message blocks sequentially as a scripted test. Assertions and extractions work exactly like .flow files.

@url = wss://api.example.com/ws
@headers
Authorization: Bearer {{API_TOKEN}}
### Authenticate
> {"type": "auth", "token": "{{API_TOKEN}}"}
# @expect within 5000
< {"type": "auth_ok"}
# @extract sessionId = $.session_id
# @assert body contains "auth_ok"
### Subscribe
> {"type": "subscribe", "channel": "prices"}
# @expect within 3000
< {"type": "subscribed"}
# @assert body contains "subscribed"

Each (file path, environment) pair has its own connection. The same .ws file with different active environments creates separate, independent connections — useful for multi-client testing.

The Session Panel (shown when a .ws file is active) shows:

  • Connection status badge — Connecting / Connected / Disconnected / Reconnecting
  • Message timeline — sent messages (→), received messages (←), system events
  • Assertion badges — ✅ / ❌ per scripted step
  • Compose bar — type and send ad-hoc messages
  • Pipeline view — visual step-by-step progress for scripted runs

Enable auto-reconnect with exponential backoff:

@url = wss://api.example.com/ws
@reconnect on

Global reconnect defaults live in Settings → WebSocket: initial delay, max delay, max attempts (0 = infinite). While reconnecting, the Session Panel shows a live countdown and a Cancel reconnect button.

KeyAction
⌘EnterConnect (if disconnected)
⌘EnterDisconnect (if connected)
⌘⇧EnterRun all steps (scripted mode)
EnterSend from compose bar
⇧EnterNewline in compose bar

See the .ws file format reference for the full syntax including all directives, authentication patterns, and binary frame support.