Hi Guys, I’m having a problem with my ionic 4 app, I have the network plugin for which I listen to network changes, both onconnect and ondisconnect. The idea is to have a clear status of the network at any time but I have seen this doesn’t always work in the right way, specially when switching the way you are connected either by wifi or mobile data.
The behaviour I see is that sometimes when you switch the wifi off and you do have mobile data the ondisconnect is fired - which could make sense but for a very brief amount on time until the mobile data is set for which the onconnect event should fire and this is not always the case. When you are offline I show a message to the user - you can imagine how annoying it could be to see ‘you are offline’ and then ‘you are online’ just after this in less than a second (which I’m currently solving with a timeout that I clear if I get another event fired before some time elapses, anyhow…), but on some cases the onconnect is not even fired.
On my app I block all http calls when this happens and with the current behavior this is not accurate at all… You can imagine how bad it could be to an user to not been able to reach the server while they DO actually have a network connection… at the moment I’m forcing to call an http call just to listen to its response in order to ensure that the user is actually offline, so an http timeout need to happen before I can tell the user he’s offline which is not ideal since this take some more time and currently I can’t rely on this native plugin. Did anyone saw this behavior before or has any tip about it ?