Search code examples
vuejs2localremote-servervue-socket.io

Vue SocketIO connexion from remote host to local hostname (http://myhostname.local)


I'm trying to exchange data through WS between a local raspberry and a webapp hosted on a remote server.

Vue.use(
  new VueSocketIO({
    debug: true,
    connection: io('http://myhostname.local:5000', {
      transports: ["websocket", "polling", "flashsocket"]
    }),
  })
);

When i use it locally (the webapp), it's working fine, but when i use it from the remote server i have no connection.

I opened the port 5000 in the remote server.

Is that possible? If yes why i can't connect from remote? If no, is there another way to pass data from a remote app to a local one?


Solution

  • I had to disable the option network.websocket.allowInsecureFromHTTPS in Firefox. (Type about:config in the URL bar)

    Here the solution for other browsers : https://www.damirscorner.com/blog/posts/20210528-AllowingInsecureWebsocketConnections.html

    I opened a bug in bugzilla because i think the browser should allow mixed content when you are trying to communicate with a local device. https://bugzilla.mozilla.org/show_bug.cgi?id=1734976