Websocket not connecting

  • We deployed app on Koyeb. Single git codebase web application with API’s and a websocket.
  • API’s are working, as expected. Websockets not.
  • We exposed the websocket ports on docker file (img1)
  • Ports are configured on the Koyeb gui
  • health checks configured on koyeb gui

We’re testing by using postman client - websocket req type (even with socket.io) with following tries;

  1. ws://base_url.koyeb.app/ws
  2. ws://base_url/ws
  3. ws://base_url.koyeb.app/ws:3000
  4. ws://base_url/ws:3000

Appreciate help from the community!

Cheers

Hello,

how are you instanciating your socket.io client?

I saw that you bound the port 3000 on a different path (/ws).

I just performed some test on your service and was able to connect with the following configuration (it also work with ws://) .

import { io } from "socket.io-client";

const socket = io("wss://<domain>/ws", {
  reconnectionDelayMax: 10000,
  query: {
    "my-key": "my-value"
  }
});

Hope this helps,

Bastien