disconnects after 2 hours.
is there any possibility of this library is miss configured and disconnects connection after 2 hours? I'm sorry i do not have any logs or debug information, but client keeps saying that the connection gets lost every 2 hours (approx)
i my self tested, the connection lasts for 10 hours, sometimes shorter. the server works fine, guess something magic is happening on serverside, which closes the connection automatically after long time..
@softmarshmallow In my case Connection lost and connect again after every 10 seconds Can u please let me know did u implement Ping/Pong on server side. Its very helpful for me Thanks
feel free to take a look
https://github.com/softmarshmallow/inked-flutter https://github.com/softmarshmallow/inked-server
Were you able to solve the issue @softmarshmallow or @jumperchen ?
Because when my app is in background, the socket is getting disconnected from the server, and then automatically connects to it. It stays 13s connected, then it disconnects and stays disconnected for 10~ seconds.
But that does not happen when my app is in foreground.
I need to get notifications from the socket server, but when it always gets disconnected when phone is locked or app is in background, I am missing the "notifications" aka socket emits statements from the server are not coming, because like 50% of the time its disconnected.
Nope, did not solve it.
@Norair1997 I'm not an expert for Flutter dev. But it seems to happen on how to run websocket in background service for android and ios. Here is the one who asked on stackoverflow for flutter - https://stackoverflow.com/questions/50538962/flutter-run-websocket-on-background
@Norair1997 I'm not an expert for Flutter dev. But it seems to happen on how to run websocket in background service for android and ios. Here is the one who asked on stackoverflow for flutter - https://stackoverflow.com/questions/50538962/flutter-run-websocket-on-background
NOT FIX THIS!
Do you guys have any solutions?
I think you guys should try Firebase Cloud Messaging for all server to client messages. There are two approaches to this:
-
Firebase + socket.io : This is a bit complicated and requires server side logic to route messages through socket.io when the client is connected or route it through Firebase when the client is disconnected.
-
Firebase only: Notifications can directly be sent through firebase. Or you can use the data message packet to trigger functions that generate the notification on your client device.
I haven't tested socket.io in background, but I have tested Firebase data messages and they deliver almost 100% of the time. I would not depend on the app to keep an active socket.io connection in the background.
Do you guys have any solutions without using firebase?