Registry / messaging / n8n-nodes-websocket-standalone

n8n-nodes-websocket-standalone

JSON →
library2.0.9jsnpmunverified

Community node package for n8n (v2.0.9) that provides standalone WebSocket trigger and response nodes, enabling real-time WebSocket server creation without relying on n8n's HTTP server. Supports custom port/path configuration, connection persistence between trigger and response nodes, automatic ping/pong keep-alive, and JSON/plain text messaging. Updated irregularly on GitHub. Differentiator: fully independent WebSocket server mode vs n8n's built-in WebSocket node.

npm install n8n-nodes-websocket-standalone
INSTALL
IMPORT
SIG · N8N-NODES-WEBSOCKE
N
n8n-nodes-websocket-standalone
messagingjavascriptv2.0.9
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

WebSocketTrigger
import { WebSocketTrigger } from 'n8n-nodes-websocket-standalone'
const WebSocketTrigger = require('n8n-nodes-websocket-standalone').WebSocketTrigger
ESM-only; named export
WebSocketResponse
import { WebSocketResponse } from 'n8n-nodes-websocket-standalone'
import WebSocketResponse from 'n8n-nodes-websocket-standalone'
Named export, not default. Both nodes exported.
WebSocketNodes
import { WebSocketNodes } from 'n8n-nodes-websocket-standalone'
Optional: combines both nodes into one array for n8n registration.

Shows how to import and configure both WebSocket Trigger and Response nodes with typical parameters for an n8n workflow.

import { WebSocketTrigger, WebSocketResponse } from 'n8n-nodes-websocket-standalone'; // Register nodes with n8n const workflow = { nodes: [ { name: 'WebSocket Trigger', type: 'n8n-nodes-websocket-standalone.WebSocketTrigger', typeVersion: 1, position: [250, 300], parameters: { port: 5680, path: '/ws', connectionId: '' } }, { name: 'WebSocket Response', type: 'n8n-nodes-websocket-standalone.WebSocketResponse', typeVersion: 1, position: [450, 300], parameters: { connectionIdMethod: 'fromInput', serverIdProperty: 'serverId', clientIdMethod: 'fromInput', clientIdProperty: 'clientId', jsonResponse: true, responseJson: '={{ $json }}' } } ], connections: { 'WebSocket Trigger': { main: [[{ node: 'WebSocket Response', type: 'main', index: 0 }]] } } }; // Export for n8n workflow JSON
Debug
Known issues
gotchaWebSocket server port must be unique per workflow execution; cannot share ports across executions.
fix
Use different ports for different workflows, or use connection ID to differentiate.
affects: >=1.0.0
gotchaThe WebSocket server starts on workflow activation but stops on deactivation; active workflows with open connections may lose state.
fix
Implement reconnection logic in clients or handle workflow lifecycle gracefully.
affects: >=2.0.0
breakingv2.0.0 changed the output format of the trigger node: 'connectionId' renamed to 'serverId' and 'clientId' added.
fix
Update workflows using the trigger node output to reference 'serverId' instead of 'connectionId'.
affects: >=2.0.0 <2.0.0
deprecatedAs of v2.0.5, the 'useContext' method for server ID is deprecated in favor of 'fromInput'.
fix
Use 'fromInput' with a serverId property or 'custom' with explicit server ID.
affects: >=2.0.5
gotchaBinary data (e.g., files) sent over WebSocket is not supported; only JSON and plain text.
fix
Encode binary data as base64 string in JSON or use a separate endpoint.
affects: >=1.0.0
Errors
Common errors & fixes
Error: listen EADDRINUSE :::5680
Port already in use by another WebSocket server or service.
fix
Change the port in the trigger node configuration to an available port.
Cannot read properties of undefined (reading 'send')
Attempting to send a response with an invalid or disconnected client ID.
fix
Verify clientId is valid and client is still connected; use connection persistence with fromInput method.
WebSocket is not open before sending: readyState 2 (CLOSING) or 3 (CLOSED)
WebSocket connection closed before response was sent, possibly due to workflow delay.
fix
Check workflow execution timing; ensure response node executes before timeout/close.
Upgrade
Version history
2.0.9latest on npm
Audit
Dependencies
n8n-workflowrequiredCore n8n types and interfaces for node development
wsoptionalWebSocket server implementation (bundled in package)
Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
n8n-nodes-websocket-standalone — npm install n8n-nodes-websocket-standalone · libregistry