Error: WebSocket connection to 'wss://apidelivery.ltai.com.br/adonis-ws' failed: Error during WebSocket handshake: Unexpected response code: 404


The error is the one above. Interesting that on localhost host works perfectly.

Settings:

/**
 * THIS CONFIGURATION IS FOR WHEN WE ARE IN DEVELOPMENT MODE
  * OR IN PRODUCTION OR USING OTHER COMPUTERS TO CREATE THE SYSTEM.
  * /
const config = [
  {
    baseUrlWebSocket: "wss://apidelivery.ltai.com.br/",
    baseUrlApiRest: "https://apidelivery.ltai.com.br"
  },
  {
    baseUrlWebSocket: "ws://192.168.129.171:3333",
    baseUrlApiRest: "http://192.168.129.171:3333"
  },{
    baseUrlWebSocket: "ws://192.168.129.171:3333",
    baseUrlApiRest: "http://127.0.0.1:3333"
  },
  {
    baseUrlWebSocket: "ws://192.168.11.52:3333",
    baseUrlApiRest: "http://192.168.11.52:3333"
  }
];

export default config[0];

//orders.js

 useEffect(() => {
    const wsInit = () => {
      ws = socket();
      ws.connect();
      ws.on("open", function () {});
    };
    wsInit();
  }, []);

//socket-config.js

import Config from './config';
function socket(){
    const ws = adonis.Ws(Config.baseUrlWebSocket);
    return ws;
}

export default socket; 

This is called where I need to use the web socket.

Is your server behind some reverse proxy like Nginx, HAProxy or similar?

Sorry for the delay. I don’t know how to inform, but I’ll check. Thank you very much.