Skip to content

Socket.IO

A Socket.IO request connects to a Socket.IO server (versions 3 and 4) and joins a namespace. Every event in both directions shows in the log; you emit events from the composer, optionally asking the server to acknowledge them. Events you emit often can be saved with the request, and On connect steps can join a room, wait for the server’s event and keep emitting every time you connect, which also makes the request a test in collection runs.

In the Collection sidebar, open the New menu (+) and choose New Socket.IO client. The request has these tabs: Connection, Emits, On connect, Params, Headers, Auth, Settings and Docs; Emits and On connect show how many they hold. There is no Scripts tab: in collection runs, the request’s tests are its wait steps.

The URL is the server and the namespace to join, as in io("http://localhost:3000/chat"):

URLJoins
http://localhost:3000the main namespace /
http://localhost:3000/chat/chat
https://…, ws://…, wss://…the same, with TLS for https and wss

Query parameters (in the URL or the Params tab) go with the handshake, like socket.io-client’s query option; the server reads them from socket.handshake.query. {{variables}} work everywhere.

SettingDefaultWhat it does
Path/socket.io/The server’s path option.
TransportWebSocket, else long-pollingConnect over WebSocket; when the server refuses WebSocket (it only allows polling), use HTTP long-polling instead and say so in the log. WebSocket only and HTTP long-polling only force one.
Auth payload (JSON)noneJSON sent when joining the namespace, like socket.io-client’s auth option (the server reads socket.handshake.auth).
Answer acknowledgements (JSON)noneWhen the server emits an event that asks for an acknowledgement, answer it right away with these arguments: an array is several arguments (["ok", {"id": 7}]), anything else one. Empty: don’t answer.

Headers from the Headers tab, the folder and the workspace, the Auth tab’s header, and cookies from the cookie jar go with the handshake (and with every long-polling request). {{variables}} work in the auth payload and the acknowledgement arguments. Changes to these settings apply the next time you connect.

Some servers emit events with a callback, as in socket.emit("ping", data, (reply) => …), and wait for the client to call it. With Answer acknowledgements filled in, Zorvik answers each such event at once with those arguments. The answer shows in the log as a sent row marked ack #3, below the event marked wants ack #3. Without it, those events stay unanswered and the server’s callback never runs.

Press Connect (or Mod+Enter). The log shows Joined /chat as … with the socket id, and Connected · Socket.IO over WebSocket (or over HTTP long-polling). Then the request’s On connect steps run. When the server’s middleware refuses the connection, the error says why, for example The server refused to let this client join /chat: Not authorized. A server running Socket.IO 2 is named as such: Zorvik connects to Socket.IO 3 and 4.

Heartbeats are answered by themselves; when the server stops sending them, the connection ends with The server stopped answering.

The composer has an Event field, an Ack checkbox, and the arguments:

ModeArguments
JSONJSON: an array is several arguments (["hi", {"n": 1}]), anything else one ({"id": 7}); empty is none.
TextThe text as one string argument.
BinaryOne binary argument, typed as hex bytes. File and Microphone emit the event once per piece, with the piece as its one binary argument (see WebSocket).

With Ack on, the server is asked to acknowledge: the sent row shows wants ack #1, and the answer arrives as ack #1 with the acknowledgement’s arguments and a green chip that says how long the server took (↩ 12 ms). Click the chip to jump to the emit it answers. {{variables}} in the event name and arguments are replaced when you emit. Press Emit or Mod+Enter.

The bookmark button at the left of the composer (Saved emits) lists the request’s saved emits: click one to put it in the composer, with its event, Ack and arguments. Save as emit… saves what is in the composer under a name (the event’s name unless you change it), and Edit saved emits opens the Emits tab.

The arrow next to Emit (More ways to send) emits what is in the composer again and again:

ChoiceDoes
Emit every second, Emit every 5 seconds, Emit every 30 secondsEmits the event now and then again at that pace.
Emit every…The same, at a pace you type in milliseconds (10 or more).

While it repeats, the composer shows Emitting every 5 s and a Stop button. Variables are filled in fresh for each emit, so [{"price": {{$randomPrice(5, 50)}}}] sends a new price every time. Repeating runs in Zorvik itself, so it keeps its pace when the window is in the background; it stops when you press Stop or the connection closes.

The Emits tab keeps events with the request, so you don’t type them again: joining a room, a subscription, a typing notice. Each has:

PartDescription
NameHow the composer menu and the On connect steps refer to it. Renaming an emit updates the steps that use it.
EventThe event to emit, for example join. An emit without one is marked.
AckAsk the server to acknowledge it.
Text, JSON or HexHow the arguments are written: Text is one string argument, JSON the arguments (an array for several, anything else one), Hex one binary argument written as hex bytes (48 65 6c 6c 6f).
The arguments{{variables}} are filled in each time it is emitted (not in hex).

The buttons on each emit: Put in the composer, Send now (while connected) and Remove message. Add emit adds an empty one. Save as emit… in the composer’s Saved emits menu does the same from what you typed; a name that is already taken replaces that emit. For a saved request it writes the emit to the request’s file at once, so teammates and AI agents can use it; emits added in the Emits tab are kept when you save the request.

The On connect tab holds steps that run in order right after every connect: join rooms, wait for the server’s event, keep emitting a heartbeat. Add step offers three kinds:

StepWhat it does
Send a saved emitEmits it.
Wait for the event … with arguments that … within … msWaits until the server emits that event with arguments that match. The time limit is 5,000 ms unless you change it (at most 10 minutes).
Keep sending a saved emit every … msEmits it now and then at that pace (10 ms or more) until the connection closes.

Use the arrows to move a step up or down; the bin removes it. A step that names an emit the request doesn’t have is marked.

Join the lobby, wait until the server confirms, then keep a typing notice going
1 Send Join
2 Wait for the event joined with arguments that JSON where $[0].room == lobby within 5000 ms
3 Keep sending Typing every 5000 ms

What a wait matches. A wait names an event, and its condition is checked against the event’s arguments, written as a JSON array: an event emitted as socket.emit("joined", {room: "lobby", users: 3}) has the arguments [{"room":"lobby","users":3}].

With arguments thatMatches when
containsThe arguments contain the text, for example lobby. Empty: the event with any arguments.
is exactlyThe arguments are exactly the text, for example ["ok"].
matches regexThe regular expression matches anywhere in the arguments (Rust regex syntax).
JSON whereThe arguments meet the JSON condition, with $[0] the first argument: $[0].room == lobby, $[1].ok == true.
any messageThe event arrived, whatever its arguments.

Leave the event empty to wait for any received event or acknowledgement whose arguments match. Like WebSocket waits, a wait looks at what arrived since the last step that emitted something, so an event that came before the wait started still counts (see WebSocket: On connect).

The steps report in the event log as notes: On connect: sent Join, On connect: got the event “joined” with arguments where $[0].room == lobby after 12 ms, On connect: sending Typing every 5 s. The first step that fails shows in red, for example On connect: waited for the event “joined”: Nothing matched within 5000 ms, and the steps after it don’t run. The connection stays open, so you can see what the server sent and carry on by hand.

Received events show the event name as a badge and their arguments as JSON; click a row for the pretty-printed arguments. An argument sent as a JSON string (socket.emit("update", JSON.stringify(data))) is shown as the JSON it holds; Raw shows the arguments as they came. Binary arguments are shown as {"base64": "…", "bytes": 3}; typing that shape in the JSON arguments sends a binary argument too. Events that ask for an acknowledgement are marked wants ack, and acknowledgements ack with the same number. The filter box searches event names and arguments; the filter’s JSON conditions, the View menu and Export the log… work as for WebSocket.

Above the log, a chip for each event name says how often it came up, sent and received, the most frequent first:

  • Click a chip to show only that event (notes and acknowledgements are hidden too); click it again to show everything.
  • Mod-click a chip to hide that event, for example a noisy heartbeat or price event. Hidden events are struck through; Mod-click again to show them.
  • Show all brings back every event.

The chips work with the filter box: a chip narrows the log to an event, the filter to what is inside it.

The Scripts tab works as for WebSocket requests: a script Before connecting, On message scripts, and a script that runs In runs after the connection closes. A message script can also match one event (empty: every event), and its pattern is matched against the event’s arguments as a JSON array ($[0].room == lobby). In the script:

NameDescription
pm.message.eventThe event’s name.
pm.message.argsIts arguments, as an array (pm.message.json() is the same array).
pm.connection.emit(event, ...args)Emits an event.
pm.connection.send(data)Emits message with data.
// On the event "joined"
pm.test("Joined the lobby", () => pm.expect(pm.message.args[0].room).to.eql("lobby"));
pm.connection.emit("hello", pm.message.args[0].room);

Acknowledgements have no event name and don’t run message scripts.

Socket.IO requests run in the Runner tab, in zorvik run and in runs an AI agent starts. Zorvik connects, runs the On connect steps, and disconnects when they are done. This works as for WebSocket requests in runs:

  • Each Wait for step is a test, named after what it waits for: Wait for the event "joined" with arguments where $[0].room == lobby, Wait for the event "joined". A wait that fails says why, for example Nothing matched within 5000 ms. After the first failure, the remaining waits are reported as skipped.
  • A Send step that fails (an emit that isn’t saved or has no event, hex that isn’t valid) is a failed test named Send Join.
  • Keep sending steps don’t run: the connection closes when the steps end.
  • Answer acknowledgements works in runs too.
  • On message scripts run on the events of the run; their tests count, as for WebSocket.
  • A request without wait steps passes when it connects. One that can’t connect (a refused namespace, a timeout) fails with the error.
  • The result’s status is the handshake’s (101 over WebSocket, 200 over long-polling), its time is the whole conversation, and its response body is the conversation as JSON, with each event’s name in event. Workspace and folder post-response scripts read it with pm.response.json():
[
{ "direction": "sent", "event": "join", "text": "[\"lobby\"]", "size": 9, "timestamp": 1790000000131.2 },
{ "direction": "received", "event": "joined", "text": "[{\"room\":\"lobby\",\"users\":3}]", "size": 27, "timestamp": 1790000000143.5 }
]

In zorvik run the request’s method shows as IO:

✓ IO Chat http://localhost:3000/chat 101 96 ms, 248 B
✓ Wait for the event "joined" with arguments where $[0].room == lobby

Load tests don’t send Socket.IO requests.

Coding agents connected through zorvik mcp can open Socket.IO connections: open_connection connects (running the request’s scripts and On connect steps, and listing its saved emits), then send_message emits (with event, and ack to ask for an acknowledgement), wait_for_message waits for an event (event, with the pattern matched against its arguments), read_messages reads the log (each message with its event) and close_connection disconnects. While you follow agents, the connection shows live in a tab. See Tools.

requests/Chat.yaml
name: Chat
kind: socketio
url: http://localhost:3000/chat?room=lobby
socketio:
auth: '{"token": "{{token}}"}'
autoAck: '["ok"]'
messages:
- name: Join
event: join
text: lobby
ack: true
- name: Typing
event: typing
format: json
text: '[{"user": "{{userName}}"}]'
onConnect:
- type: send
message: Join
- type: wait
event: joined
match: json
pattern: $[0].room == lobby
- type: repeat
message: Typing
everyMs: 5000
event: message
ack: true
body:
type: json
text: '["hello", {"from": "{{userName}}"}]'
FieldDefaultDescription
socketio.path/socket.io/The server’s path.
socketio.transportautoauto, websocket or polling.
socketio.authnoneThe auth payload as JSON text.
socketio.autoAcknoneAnswer acknowledgements: the arguments as JSON text.
socketio.messagesnoneSaved emits: name, event, ack (default false), format (text (default) for one string argument, json for the arguments, or binary for hex bytes) and text.
socketio.onConnectnoneSteps, in order. type: send with message (a saved emit’s name); type: wait with event, match (any, contains (default), exact, regex or json), pattern and timeoutMs (default 5000); type: repeat with message and everyMs.
socketio.event, socketio.acknone, falseWhat the composer emits.
body.text, body.typeThe composer’s arguments and mode (json or text).