Flic Home

    Community

    • Login
    • Search
    • Popular
    • Users

    Flic HUB SDK Error connecting to a remote websocket server (wss)

    Developers
    flic hub sdk websocket net server
    2
    2
    681
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • antonio.mestre
      antonio.mestre last edited by

      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);
      })

      Emil 1 Reply Last reply Reply Quote 0
      • Emil
        Emil FlicTeam @antonio.mestre last edited by

        @antonio-mestre the net module implements just a raw TCP socket. The secure web socket protocol uses the Websocket protocol on top of the TLS protocol on top of the TCP protocol.

        Right now our sdk unfortunately does not include modules for TLS (but we have https) nor Websocket, so you would have to implement that yourself if you want to use wss, using the net module in the bottom for TCP.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post