I am hosting my socket.io server on heroku and I am running the client-side of the application on localhost. On the frontend I establish the socket.io connection like this:
const socket = io("https://<my-app-name>.herokuapp.com:5000/");
And the backend looks like this:
const port = 5000;
const io = require("socket.io")(port, { cors: { origin: "*" } });
io.on("connection", (socket) => { console.log(socket.id) }
But the connection won't establish and in the console of my browser I receive this error:
GET https://<my-app-name>.herokuapp.com:5000/socket.io/?EIO=4&transport=polling&t=Nym-K6b net::ERR_CONNECTION_TIMED_OUT
BTW it works just fine when I'm running the server-side on my localhost too.