Open nagamanojv opened 7 years ago
You can use the onnetwork connectivity change listener to detect internet connectivity. I would recommend using library https://github.com/zplesac/android_connectionbuddy, if you want to save time.
Hi @sacOO7 I tried that library but it has the same problem it seems. It checks if network status change (from connected to disconnect or vice versa) but when connectivity changes when network status not changed (connected to hotspot which inturn lost connection).
I think I have to check for PING frames while receiving data, I will try to add some solution today regarding issue. Remind me of this issue in case I forget to do it. Thanks for your time.
Hi @sacOO7 will you be doing that ping frames related change soon.! I am kind of blocked on it for now.
Yeah will do it today :)
On Jun 29, 2017 9:36 AM, "nagamanojv" notifications@github.com wrote:
Hi @sacOO7 https://github.com/sacoo7 will you be doing that ping frames related change soon.! I am kind of blocked on it for now.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sacOO7/socketcluster-client-java/issues/13#issuecomment-311857064, or mute the thread https://github.com/notifications/unsubscribe-auth/AP8vSVLWDJ0e1ZdUt3S8F494sKcbg7PNks5sIyKvgaJpZM4N7DfS .
Hi @sacOO7 when I set
ws.setPingInterval(5000);
in Socket.java in connect()
method, it seems to be working. i.e application is identifying disconnection immediately in the case we discussed earlier. Is it the change you were planning to make or there is something else should be done.
Really sorry to go after you on this but this is a bit critical for me.
It seems you were able to access raw websocket instance. Yes, you are right !!! I was talking about same solution for identifying disconnection. I might have to add that code internally. But as you can see, you can actually have instance and perform required operations on it :)
I did it in your code only :) Forked it, checked out, made changes and tried. It worked.
I am just worried about the effect on data usage because of this change. What would be the ideal interval for ping (given that the value is 8 seconds at the server, though that is configurable). I know the ideal interval is dependent on how quickly I need to identify but as I said I also have limitation on the data the app use. If the ping frames consume too much data, then I will have to compromise on the frequency.
There won't be a lot of consumption in the data. You don't have to worry about it. It's in some bytes sent after some interval. Even for 1KB it will take 2 minutes.
Hi @sacOO7 , I am currently facing the exact issue you reported with neovisionaries. I am using it in Android phones majority of which are on 2G sims. Several times it happens that android doesn't identify the connection is broken(2G symbol available) but the connection with server is broken. It never identifies the connection is broken and never initiates the reconnection loop until the phone is rebooted or the internet connection is gone completely.
Is there any work around at the moment.?