### 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)