WebSocket Client
Send message to WebSocket Server.
Opens a WebSocket connection, sends one message and either closes at once or waits for the first message back.
How it works
- Resolves the config.
connection_id,messageandwaitForResponse(default false) fall back to the same keys of the incoming payload;connection_idandmessageare required. - Resolves the credential: the URL is
config.url; when the secret hastoken, the handshake sendsAuthorization: Bearer <token>. - Opens the connection and sends
messageas soon as it is open. - Without
waitForResponse, closes and returns{ result: "sent" }. With it, waits for the first incoming message, closes and returns it as text inresult.
In a workflow
The node as it appears in a workflow file (draft_nodes[]), and the envelope of a successful run.
{
"node_id": "node-push-event",
"label": "Push event",
"operator_slug": "io.websocket",
"operator_version": "1.0.0",
"config": {
"connection_id": "pi-credential-xxxx",
"message": "{{ JSON.stringify($json.event) }}",
"waitForResponse": true
}
}{
"ok": true,
"data": {
"result": "{\"type\":\"ack\",\"id\":\"msg_881\"}"
},
"port": "out"
}Configuration
-
connection_idstring Required -
Credential for the WebSocket endpoint. Accepts credentials of type `api-key`, `basic-auth`, or `object` (custom handshake headers).
-
messagestring Required -
Message to send
-
waitForResponseboolean Optional
Behaviour in the code
What the implementation does with these keys beyond what the schema says.
-
connection_id - The URL comes from the credential config
url; onlytokenis read from the secret.api-keyandbasic-authsecrets add no handshake header. A value starting withws://orwss://is used as the URL itself, without authentication. -
message - Must be a string. To send JSON, build the string first, for example
{{ JSON.stringify($json.event) }}. -
waitForResponse - Waits without a time limit. If the server never sends a message, or closes without one, the node does not finish.
Output ports
out default The message was sent (result is "sent") or, with waitForResponse, the first reply arrived (result is its text).
{
"result": "{\"type\":\"ack\",\"id\":\"msg_881\"}"
}error A required field is missing, the credential cannot be resolved, or the connection failed.
{
"error": "Unexpected server response: 401"
}In expressions
What a later node can read from this node's output with $("WebSocket Client").item.json.<path> (write your node's label instead of WebSocket Client). Editor marks the paths the workflow editor suggests under Previous Nodes (the output contract); Worker marks the paths the worker really returns through out, from the output shown in Ports.
| Expression | Editor | Worker |
|---|---|---|
$("WebSocket Client").item.json.resultAck or Response |
Errors
| Message | Port | Cause and fix |
|---|---|---|
Unexpected server response: <status> | error | The server refused the upgrade (for example 401 or 404). Check the URL and the token in the credential. |
message is required | error | The message is empty in the config and in the incoming payload (connection_id is required is the equivalent for the credential). |
Failed to resolve connection <connection_id>: <detail> | error | The credential does not exist or this workflow cannot use it. |
Input contract
-
connection_idstring Required -
messagestring Required -
waitForResponseboolean Optional
Output contract
-
resultstring Optional -
Ack or Response
Contracts (JSON Schema)
The definition exactly as the orchestrator declares it. All is the whole *.definition.js; compare it with the sections above to spot differences between the documentation and the schema. Use it to validate a node before you publish.
{
"slug": "io.websocket",
"name": "WebSocket Client",
"category": "io",
"version": "1.0.0",
"description": "Send message to WebSocket Server.",
"capabilities": [
"websocket",
"realtime",
"messaging"
],
"config_schema": {
"type": "object",
"properties": {
"connection_id": {
"type": "string",
"title": "WebSocket Credential",
"description": "Credential for the WebSocket endpoint. Accepts credentials of type `api-key`, `basic-auth`, or `object` (custom handshake headers).",
"ui_widget": "connection_picker",
"ui_options": {
"credential_types": [
"api-key",
"basic-auth",
"object"
],
"types": [
"websocket"
]
}
},
"message": {
"type": "string",
"description": "Message to send"
},
"waitForResponse": {
"type": "boolean",
"default": false
}
},
"required": [
"connection_id",
"message"
]
},
"input_contract_schema": {
"type": "object",
"properties": {
"connection_id": {
"type": "string"
},
"message": {
"type": "string"
},
"waitForResponse": {
"type": "boolean"
}
},
"required": [
"connection_id",
"message"
]
},
"output_contract_schema": {
"type": "object",
"properties": {
"result": {
"type": "string",
"description": "Ack or Response"
}
}
},
"ports": [
{
"port_id": "out",
"label": "Sent/Response",
"description": "Message sent or response received",
"is_default": true,
"supports_condition": true
},
{
"port_id": "error",
"label": "Error",
"description": "Connection or transmission error",
"is_default": false,
"supports_condition": false
}
],
"execution_mode": "async",
"required_resources": [],
"compatible_worker_pools": [
"standard-io",
"realtime"
],
"tags": [
"realtime",
"messaging"
],
"is_stateful": false,
"publisher": {
"identity": "org_link_loom",
"profile": {
"name": "Link Loom",
"verified": true,
"url": "https://me.veripass.com/link-loom",
"logo_url": null
}
}
}{
"type": "object",
"properties": {
"connection_id": {
"type": "string",
"title": "WebSocket Credential",
"description": "Credential for the WebSocket endpoint. Accepts credentials of type `api-key`, `basic-auth`, or `object` (custom handshake headers).",
"ui_widget": "connection_picker",
"ui_options": {
"credential_types": [
"api-key",
"basic-auth",
"object"
],
"types": [
"websocket"
]
}
},
"message": {
"type": "string",
"description": "Message to send"
},
"waitForResponse": {
"type": "boolean",
"default": false
}
},
"required": [
"connection_id",
"message"
]
}{
"type": "object",
"properties": {
"connection_id": {
"type": "string"
},
"message": {
"type": "string"
},
"waitForResponse": {
"type": "boolean"
}
},
"required": [
"connection_id",
"message"
]
}{
"type": "object",
"properties": {
"result": {
"type": "string",
"description": "Ack or Response"
}
}
}[
{
"port_id": "out",
"label": "Sent/Response",
"description": "Message sent or response received",
"is_default": true,
"supports_condition": true
},
{
"port_id": "error",
"label": "Error",
"description": "Connection or transmission error",
"is_default": false,
"supports_condition": false
}
]Execution
- Execution
async- Stateful
- No
- Credentials
- Resolved on the server from
connection_id; the secret never reaches the workflow. - Capabilities
websocketrealtimemessaging- Tags
realtimemessaging
Notes and limits
- Only the first incoming message is returned; later messages are discarded. A binary reply is converted to text.
- A new connection is opened and closed on every run. No retries.
Reviewed against the orchestrator code · 31e874b · 2026-11-26