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

105
Visualizações
React JS socket IO disconnection issue

I'm creating a chat application where Backend is in Node.js and Frontend is in ReactJS.

Here is the client-side code to connect with Socket IO.

socketRef.current = io("SOCKET-URL", {
    transports: ["websocket"],
    upgrade: false,
    reconnection: true,
});

and Backend Node.js code is as follow.

const io = new Server(httpsServer, {
    pingInterval: 25000,
    pingTimeout: 60000,
    cors: {
        methods: ["GET", "POST"],
    },
})

Now we're having issues with socket disconnection and it is being disconnected frequently. Obviously, I've handled reconnection after disconnection though it is not working as expected. I've tried multiple scenarios i.e Long Polling fails and XHR Long Polling. During my R&D, it seems like we've to resolve it from FrontEnd but not sure how. :).

Also, I've handled a queue mechanism to receive multiple messages in Backend. I've written code in ReactJS to send N number of messages one by one but it is being disconnected after some messages and it stuck. My goal is, all messages must be received by receiver without any error from Socket. Herewith attached screenshot for reference.

FYI. I'm using Socket.IO 4.4.0 version for both.

enter image description here

Please help me to resolve this problem.

about 4 years ago · Santiago Trujillo
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