# Built-in websocket nodes not compatible with Node.js 18?

**URL:** <https://discourse.nodered.org/t/built-in-websocket-nodes-not-compatible-with-node-js-18/73592>\
**Category:** General\
**Created:** [12 January 2023 12:30 UTC](https://discourse.nodered.org/t/built-in-websocket-nodes-not-compatible-with-node-js-18/73592 "2023-01-12T12:30:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![parasaurolophus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/parasaurolophus/32/18729_2.png) [@parasaurolophus](https://discourse.nodered.org/u/parasaurolophus)\
**Post date:** [12 January 2023 12:30 UTC](https://discourse.nodered.org/t/built-in-websocket-nodes-not-compatible-with-node-js-18/73592/1 "2023-01-12T12:30:22Z")

</div>

Is this a known issue? (Maybe the reason the NR 3.0.2 installation script still installs Node.js 16?)

In any event (pun intended), websocket server ("listen to") nodes appear to be broken in NR 3.0.2 under Node.js 18.12.1 (the latest LTS version as of the time I had reason to configure a new Raspberry Pi a short while ago). Does anyone know of a work-around other than "use MQTT instead" or "keep using the out-of-date Node.js?" 😉

Thanks in advance for any info.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [12 January 2023 12:35 UTC](https://discourse.nodered.org/t/built-in-websocket-nodes-not-compatible-with-node-js-18/73592/2 "2023-01-12T12:35:24Z")

</div>

> [@parasaurolophus](#):
>
> "keep using the out-of-date Node.js?

Node JS v16 LTS is still "in date" 🙂

> [@parasaurolophus](#):
>
> Is this a known issue?

I dont recall it being raised - have you looked (or raised) an issue on the node-red repository?

---

<div class="post-metadata">

**Author:** ![parasaurolophus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/parasaurolophus/32/18729_2.png) [@parasaurolophus](https://discourse.nodered.org/u/parasaurolophus)\
**Post date:** [12 January 2023 13:31 UTC](https://discourse.nodered.org/t/built-in-websocket-nodes-not-compatible-with-node-js-18/73592/3 "2023-01-12T13:31:58Z")

</div>

> Node JS v16 LTS is still "in date" 🙂

Ok, "...superseded..." 🙂

> dont recall it being raised - have you looked (or raised) an issue on the node-red repository?

Didn't see an issue matching this particular compatibility problem on the node-red repo. Just added one.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [12 January 2023 14:31 UTC](https://discourse.nodered.org/t/built-in-websocket-nodes-not-compatible-with-node-js-18/73592/4 "2023-01-12T14:31:28Z")

</div>

Are you getting any error messages? Have you tried increasing the Node-RED logging level to see what is happening?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [12 January 2023 14:31 UTC](https://discourse.nodered.org/t/built-in-websocket-nodes-not-compatible-with-node-js-18/73592/5 "2023-01-12T14:31:52Z")

</div>

Please post a link to it so those interested can watch it.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [12 January 2023 17:26 UTC](https://discourse.nodered.org/t/built-in-websocket-nodes-not-compatible-with-node-js-18/73592/6 "2023-01-12T17:26:18Z")

</div>

> <https://github.com/node-red/node-red/issues/4010>
>
> \### Current Behavior
> 
> WebSocket client ("connect to") nodes fail to connect to s…erver ("listen to") nodes when the latter are running under Node.js 18.12.1.
> 
> \### Expected Behavior
> 
> WebSocket connections should work consistently on LTS version of Node.js as well as earlier versions.
> 
> \### Steps To Reproduce
> 
> 1. Install Node.js LTS
> 2. Install Node-RED using the standard Debian script without specifying a version of Node.js
> 3. Create a pair of "listen to" and "connect to" websocket nodes using the corresponding URI and URL values such that they should connect, e.g. "listen to" URI = /test and "connect to" URL = ws://localhost:1880/test
> 
> In my case, the latter works when the "listen to" node is running under Node.js 16.x but not when it is running under 18.x. 
> 
> If it helps in debugging, "connect to" nodes running under Node.js 18.x do appear able to connect to "listen to" nodes on the network when the "listen to" nodes are running under 16.x. I.e. the issue appears to be on the server side.
> 
> \### Example flow
> 
> \`\`\`
> \[
> {
> "id": "ef1453a3ef0962a6",
> "type": "tab",
> "label": "WebSocket Test",
> "disabled": false,
> "info": "",
> "env": \[\]
> },
> {
> "id": "4cfc8d3ec3a4b40b",
> "type": "websocket in",
> "z": "ef1453a3ef0962a6",
> "name": "",
> "server": "1f015a9cb54deefa",
> "client": "",
> "x": 240,
> "y": 180,
> "wires": \[
> \[
> "d7ee73bf93a4919a"
> \]
> \]
> },
> {
> "id": "29e40922241ebcd3",
> "type": "websocket out",
> "z": "ef1453a3ef0962a6",
> "name": "",
> "server": "1f015a9cb54deefa",
> "client": "",
> "x": 600,
> "y": 180,
> "wires": \[\]
> },
> {
> "id": "d7ee73bf93a4919a",
> "type": "change",
> "z": "ef1453a3ef0962a6",
> "name": "",
> "rules": \[
> {
> "t": "delete",
> "p": "\_session",
> "pt": "msg"
> }
> \],
> "action": "",
> "property": "",
> "from": "",
> "to": "",
> "reg": false,
> "x": 420,
> "y": 180,
> "wires": \[
> \[
> "29e40922241ebcd3"
> \]
> \]
> },
> {
> "id": "eeba8377b2b3fae4",
> "type": "websocket in",
> "z": "ef1453a3ef0962a6",
> "name": "",
> "server": "",
> "client": "78b63c8224717d1a",
> "x": 300,
> "y": 280,
> "wires": \[
> \[
> "1402b256df6187d6"
> \]
> \]
> },
> {
> "id": "1402b256df6187d6",
> "type": "debug",
> "z": "ef1453a3ef0962a6",
> "name": "debug 1",
> "active": true,
> "tosidebar": true,
> "console": false,
> "tostatus": true,
> "complete": "payload",
> "targetType": "msg",
> "statusVal": "",
> "statusType": "counter",
> "x": 500,
> "y": 280,
> "wires": \[\]
> },
> {
> "id": "1f015a9cb54deefa",
> "type": "websocket-listener",
> "z": "ef1453a3ef0962a6",
> "path": "/test",
> "wholemsg": "true"
> },
> {
> "id": "78b63c8224717d1a",
> "type": "websocket-client",
> "z": "ef1453a3ef0962a6",
> "path": "ws://localhost:1880/test",
> "tls": "",
> "wholemsg": "true",
> "hb": "5",
> "subprotocol": ""
> }
> \]
> \`\`\`
> 
> 
> \### Environment
> 
> \- Node-RED version: 3.0.2
> \- Node.js version: 18.12.1
> \- npm version: 8.19.2
> \- Platform/OS: Raspberry Pi OS (bullseye)
> \- Browser: Chromium 104.0.5112.105 (Official Build) Built on Raspbian , running on Raspbian 11 (32-bit)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [13 March 2023 17:26 UTC](https://discourse.nodered.org/t/built-in-websocket-nodes-not-compatible-with-node-js-18/73592/7 "2023-03-13T17:26:56Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
