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

364
Views
Expo React Native socket.io listeners "went lost"

I am developing a chat app with socket.IO (frontend: React Native, backend: NodeJS). Everything works fine but sometimes messages are not sent and I discovered the problem is due to socket listeners, which sometimes went lost without an apparent reason. Infact, when mounting the component, i call useEffect to subscribe listeners like this:

useEffect(() => {
        socket.on("receiveMessage", callback);
        socket.on("receiveAck, callback);
        ... and others
},[])

if i console.log(socket._callbacks), the result is an array with the names of listeners and their relative callbacks

for example: console.log(socket._callbacks) => [ ["receiveMessage", callback function], ["receiveAck", callback function], ...]

when messages begin to not work properly, i console.log(socket._callbacks) and the result is an EMPTY ARRAY, so it's like all the listeners went lost. And the strange thing is that it happens even when the socket is correctly connected to the server (console.log(socket.connected) => true).

why this happens?

about 4 years ago · Juan Pablo Isaza
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!