In case you are running the code on your device, Verify your antivirus settings. Antiviruses often mess all-around with e mail ports utilization. Node.js won't understand the MITM cert your antivirus is using.
In https://anitapdji692356.isblog.net/nodejs-websocket-can-be-fun-for-anyone-47512512