A Node-RED custom node that establishes and manages WebSocket connections with dynamic URL switching at runtime. Version 1.1.1 requires Node >=18.0.0. Unlike the built-in WebSocket node, this node allows changing the WebSocket URL mid-flow via msg.url, supports authentication (basic, token, custom headers), advanced reconnection with exponential backoff, and message transformation with validation. It also handles self-signed certificates and binary data. The node has one input and three outputs (received messages, connection status, connection errors). It persists the last connected URL across Node-RED restarts.
npm install node-red-contrib-dynamic-websocketNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sample Node-RED flow: inject sets URL, dynamic-websocket connects, outputs to three debug nodes for messages, status, and errors.
Upgrade Node.js to version 18 or later.
Send msg.close to clear the stored URL before redeploy or restart.
Use msg.message property to send raw data (string or Buffer) or enable binary support for Buffers.
Set allowSelfSigned: true in node config or via msg.allowSelfSigned.
Use require() and avoid import/export syntax.
Check for string payloads if you expect objects; set msg.payload to parse manually.
Use Node-RED 1.0.0 or later.
Kill other Node-RED process or change port in settings.js.
Install the package via npm install node-red-contrib-dynamic-websocket and restart Node-RED.
Set allowSelfSigned: true in node configuration or set msg.allowSelfSigned = true before connecting.
Check server address and port, ensure server is running.
Enable binary support in node config or disable binary sending from server.