Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

106
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!