socket.io-client-dart icon indicating copy to clipboard operation
socket.io-client-dart copied to clipboard

Doesn't autoreconnect when going in/out of airplane mode (flutter)

Open mlp1802 opened this issue 5 years ago • 1 comments

I set "reconnection" to true..according to code, reconnectionAttempts are infinity. After going in airplane mode, I see one reconnect attemp and that's it. After going out of airplane mode, sockets are not connected anymore. That means, a user loses connection even briefly, the app becomes detached from the server and the app doesn't work as intended.

I fear this might also be a problem if an app has been too long in background mode?

mlp1802 avatar Mar 06 '20 19:03 mlp1802

@mlp1802 Have you tried to set pingTimeout and pingInterval?

For example:

Socket socket = io(URL, <String, dynamic>{
    'pingTimeout': 5000,
    'pingInterval': 10000,
});

JanMate avatar Sep 15 '20 13:09 JanMate