Skip to main content

Socket.IO

Rostyman includes a dedicated Socket.IO client for testing event-driven real-time applications. It handles the full connection lifecycle — connecting, emitting named events with JSON payloads, receiving all server-emitted events automatically, and displaying a timestamped event log with directional indicators.

Socket.IO is a distinct protocol from raw WebSocket. It starts with an HTTP handshake and then upgrades to a WebSocket transport, adding its own framing, namespaces, acknowledgements, and reconnection logic on top. Use this client for servers built with socket.io (Node.js), python-socketio, or any other Socket.IO-compatible library. If your server speaks raw WebSocket without Socket.IO framing, use the WebSocket client instead.

Opening a Socket.IO Tab

Click + New Tab and select Socket.IO, or open a saved Socket.IO request from the sidebar. Each tab holds its own connection, event log, and settings independently.

The URL Bar

Enter the full HTTP or HTTPS URL of your Socket.IO server — not a ws:// URL:

http://localhost:3000
https://api.example.com
https://realtime.myapp.com/chat

The path segment after the host (e.g., /chat) is the Socket.IO namespace, which lets a single server multiplex multiple logical channels. Namespaces are distinct from the Socket.IO server path (see Settings below).

Environment variables are resolved using {{variableName}} syntax at connect time. The URL bar stores the raw template; the resolved value is sent to the server.

Connection Status Indicator

A colored dot in the URL bar shows the current state:

StatusColorMeaning
DisconnectedGrayNo active connection
ConnectingAmberHandshake in progress
ConnectedGreenConnected and ready to emit/receive
ErrorRedConnection failed or closed with an error

Environment Selector

The Environment dropdown in the URL bar row selects which environment's variables are used to resolve {{variables}} in the URL and settings payloads. This sets the active environment for the entire collection the request belongs to.

Connect and Disconnect

Click Connect to open the Socket.IO connection. The button shows a plug icon. If the server requires auth or query parameters, configure them in the Settings tab first.

Once connected, the button changes to Disconnect (red, unplug icon). Clicking it closes the connection immediately. The event log is preserved after disconnecting.

If the connection fails (wrong URL, server refused, invalid auth), the status changes to Error and a system entry appears in the log with the error detail.


Sub-tabs

Three sub-tabs appear below the URL bar:

Emit Tab

The Emit tab is where you compose and send events to the server.

Event Name field

A text input at the top of the tab accepts the name of the event to emit:

message
chat:send
join-room
ping
user:typing

Event names can be any string your server listens for. Environment variables ({{variable}}) are resolved in the event name at emit time.

JSON Payload Editor

A full Monaco editor below the event name field holds the payload to send with the event. The editor uses JSON syntax highlighting and supports:

  • Syntax highlighting and bracket matching
  • Line numbers and word wrap
  • {{variable}} interpolation (resolved at emit time)
  • Comments (stripped before sending — see JSON Comments below)

Default payload:

{

}

Beautify Button

The ✨ Beautify button auto-formats the JSON payload with standard 2-space indentation. Useful before emitting to verify the payload is valid.

Emit Button

Click Emit (or press Enter in the event name field) to send the event. The button is disabled and dimmed when there is no active connection or the event name is empty.

When an event is emitted successfully, it immediately appears in the Event Log as a sent entry.

Events (Listeners) Tab

The Events tab shows information about auto-captured events. Rostyman automatically listens for all events emitted by the server — there is no need to pre-declare event names you want to receive. Every event the server emits appears in the Event Log as it arrives.

This tab notes that event capture is automatic and passive. You do not need to configure subscriptions.

Settings Tab

The Settings tab provides three configuration sections. All settings take effect on the next Connect.

Socket.IO Path

By default, Socket.IO servers register at /socket.io. If your server uses a custom path, specify it here:

/socket.io
/my-custom-path/
/v2/realtime/

This is distinct from the namespace in the URL. The path is the endpoint the HTTP upgrade request targets; the namespace is the logical channel within the Socket.IO server at that endpoint.

Default: /socket.io

Auth (JSON)

Socket.IO supports an auth object passed during the handshake. Many servers use this for token-based authentication — the auth payload is available in the socket.handshake.auth object on the server side.

Enter a JSON object:

{
"token": "Bearer {{access_token}}",
"userId": "{{current_user_id}}"
}

Environment variables are resolved before the payload is sent. If the field is left empty, no auth object is sent. Invalid JSON is silently ignored (the connect proceeds without auth).

Query Parameters (JSON)

Enter a JSON object whose keys and values are appended as query parameters to the HTTP handshake URL:

{
"room": "lobby",
"version": "2",
"clientId": "{{device_id}}"
}

These appear as ?room=lobby&version=2&clientId=... on the upgrade request. They are available on the server in socket.handshake.query. Environment variables are resolved at connect time.


Event Log Panel

The Event Log appears at the bottom of the tab and shows a chronological list of all events for the current session (oldest at top, newest at bottom). It auto-scrolls to the latest entry.

Filter Buttons

FilterWhat it shows
AllEvery log entry
SentEvents you emitted
ReceivedEvents received from the server
SystemConnection lifecycle events (connected, disconnected, errors)

The total entry count is shown next to the log title.

Clear Button

The trash icon clears the event log without disconnecting. Log clearing is session-only — it does not affect the saved request.

Event Rows

Each row in the log displays:

ElementDescription
TimestampHH:MM:SS when the entry was added
Direction icon↑ (green) for sent, ↓ (blue/accent) for received, · (muted) for system
Event nameThe Socket.IO event name, shown in the accent color
Payload previewThe event data, truncated with ellipsis if long, displayed in monospace

The log retains the last 500 entries per session.


JSON Comments

You can include comments in your JSON payload using // for single-line comments and /* */ for block comments. Comments are stripped before the payload is sent — the server receives valid JSON.

{
// Which room to join
"room": "general",
/* The user's display name,
pulled from the active environment */
"username": "{{username}}"
}

Reconnection

Socket.IO has built-in reconnection logic. If the connection drops unexpectedly, the client will attempt to reconnect automatically. The status indicator reflects each state transition during reconnection. To manually reconnect, click Disconnect and then Connect again.


Saving to a Collection

Press Ctrl+S (or Cmd+S on macOS) to save the Socket.IO connection.

  • New tab — the Save As dialog appears. Choose a collection, optional folder, and a name.
  • Saved tab — the Save button highlights in the accent color when there are unsaved changes. Clicking it saves immediately without a dialog.

What is persisted:

  • Server URL (with variable placeholders intact)
  • Settings (custom path, auth JSON, query parameters JSON)
  • Current event name and payload in the editor

The event log is session-only and is not saved.


Tips

  • Use environment variables in the auth JSON and query parameters for tokens, user IDs, and room names — switch environments without editing the request
  • Socket.IO event names are case-sensitive: Message and message are different events
  • If the server requires a non-default namespace (e.g., /admin), include it in the URL: http://localhost:3000/admin
  • The event log is preserved across disconnect/reconnect cycles — you can reconnect and continue reviewing earlier events in context
  • If you see only system events (connect/disconnect) but no received events, verify the event names match what the server actually emits