Package Information
Released: 5/19/2025
Downloads: 83 weeklyย /ย 654 monthly
Latest Version: 1.1.6
Author: subin.soman
Documentation
n8n-nodes-websocket-standalone
This is a node package for n8n that adds standalone WebSocket server functionality to your workflows. It provides WebSocket Trigger and Response nodes that allow you to create independent WebSocket servers and handle real-time communication in your n8n workflows.
Features
- ๐ WebSocket Trigger node to start workflows on WebSocket messages
- ๐ค WebSocket Response node to send messages back to clients
- ๐ Standalone WebSocket server implementation (no dependency on n8n's HTTP server)
- ๐ข Custom port configuration for each WebSocket server
- ๐ฃ๏ธ Custom path configuration for WebSocket endpoints
- ๐ Robust connection handling with automatic ping/pong keep-alive
- ๐ Connection persistence between trigger and response nodes
- ๐งช Enhanced stability for testing and production workflows
Installation
In n8n:
- Go to Settings > Community Nodes
- Select Install
- Enter
n8n-nodes-websocket-standalone
in Enter npm package name - Click Install
Manual Installation:
npm install n8n-nodes-websocket-standalone
Usage
WebSocket Trigger Node
- Add a "WebSocket Trigger" node to your workflow
- Configure the port (default: 5680) and path (default: /ws)
- Optionally set a custom connection ID
- The node will create a WebSocket server at
ws://localhost:{port}{path}
- When a message is received, the workflow will be triggered with the message data
WebSocket Response Node
- Add a "WebSocket Response" node after your processing nodes
- Configure how to obtain the server ID and client ID:
- From input (using the data passed from the trigger node)
- Custom (manually specify IDs)
- Use context server (automatically find active server)
- Set your response data (JSON or plain text)
- The node will send the response to the specified client(s)
Example Client Code (Browser)
// Connect to your configured WebSocket server
const ws = new WebSocket('ws://localhost:5680/ws');
// Send a message
ws.send(JSON.stringify({
message: 'Hello from client!'
}));
// Receive messages
ws.onmessage = (event) => {
console.log('Received:', event.data);
};
Example Client Code (Node.js)
const WebSocket = require('ws');
// Connect to your configured WebSocket server
const ws = new WebSocket('ws://localhost:5680/ws');
// Send a message when connection is established
ws.on('open', function open() {
ws.send(JSON.stringify({
message: 'Hello from Node.js client!'
}));
});
// Receive messages
ws.on('message', function message(data) {
console.log('Received:', data);
});
Advantages Over Other WebSocket Nodes
- Standalone Operation: Works independently of n8n's HTTP server
- Customizable Endpoints: Configure port and path for each WebSocket server
- Connection Stability: Maintains connections between trigger and response nodes
- Keep-Alive Mechanism: Automatic ping/pong to prevent timeouts
- Execution Tracking: Prevents connections from closing during workflow testing
- Retry Logic: Reliable message delivery with automatic retries
Development
- Clone the repository
git clone https://github.com/subinsoman/n8n-nodes-websocket-standalone.git
- Install dependencies
npm install
- Build the package
npm run build
- Link to your n8n installation
npm link
cd /path/to/n8n
npm link n8n-nodes-websocket-standalone
License
Support
For issues and feature requests, please create an issue on GitHub.