Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

182
Visualizações
Establish socket.io connection to heroku app

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.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

https://socket.io/docs/v4/troubleshooting-connection-issues/#the-server-is-not-reachable

Please make sure the Socket.IO server is actually reachable at the given URL. You can test it with: curl "<the server URL>/socket.io/?EIO=4&transport=polling" which should return something like this: 0{"sid":"Lbo5JLzTotvW3g2LAAAA","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":20000}. If that's not the case, please check that the Socket.IO server is running, and that there is nothing in between that prevents the connection.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda