How to add socket.io to embeded node js app generated by shopify cli

I am trying to add socket functionality to the node js embedded app generated by the cli but the client is unable to make a connection to the server.

On the server, inside the createServer function I have this

const app = express();
  const server = http.createServer(app);

const io = new Server(server);

  io.on("connection", (socket) => {
    console.log("A user is connected");

    socket.on("message", (message) => {
      console.log(`message from ${socket.id} : ${message}`);
    });

    socket.on("disconnect", () => {
      console.log(`socket ${socket.id} disconnected`);
    });
  });

on the client side I try to connect this way:

const socket = io("apps/widgets/")

I have shopify proxy setup for “apps/widgets” which point to the root (/) of the server