Hello,
I'm trying to connect my HUB to a remote websocket server, but none of the solutions i tried worked. I'm using the 'net' library becausa is the given by SDK and i can't use others like socket.io. The server domain starts with "wss://...", but if i use it, that gives me an Error ECONNREFUSED (connection refused). If i remove the part "wss://..." of the domain and set the port to 443 IT SAYS THAT THE CONNECTION WAS MADE, but i checked my server and the HUB IS NOT CONNECTED to the WSS server.
If i use the same code, but changing the server domain to a local ip address it works fine. So i don't know if the problem is the fact that is a remote WSS server, but i think the code is not wrong.
Code :
var client1 = net.createConnection(433, domain, function() {
console.log("Connected")
});
client1.on("data", function (data) {
console.log(data.toString());
})
client1.on("end", function () {
console.log("ended");
})
client1.on("error", function (data) {
console.log(data);
})