My code is:
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
var WebSocket = require('ws')
var ws = new WebSocket('wss://example.com:2217/?key=asdsaasd',{
});
ws.on('open', function() {
console.log(ws.readyState)
});
ws.on('close', function() {
console.log(ws.readyState+" closed")
});
ws.on('message', function(message) {
console.log('received: %s', message);
});
ws.on('error', function(e) {
console.log(e)
});
When I try to connect, I get the following output:
1
3 closed
I couldn't find any enlightening information on the internet about building WebSockets over SSL/TLS Client using Node JS and I failed. Could you please help me with this?