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

125
Views
SocketIO get connection status / reconnect on mobile

Hi I've finally got my nodejs page to run but I noticed that mobile devices immediately drop the connection if the screen is turned off.

How can my client check if it's still connected and reconnect if not (once the screen is back on)? Or is there a way to prevent the disconnect in the first place?

Are there events i could use to go off of, or would i need to use an interval to check it?

Reconnecting immediately on disconnect probably wouldn't do any good because the screen is still off and the connection would just be closed again moments after, right?

just as a baseline here are the names of my server objects:

/* Server */
const socketio = require('socket.io');
const app = express();
const server = http.createServer(app);
const io = socketio(server);

io.on('connection', socket => {
    socket.on('joinRoom', ({ username, room }) => {
...

/* Client */
const socket = io();

socket.emit('joinRoom', { username, room });
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!