App/mobile reconnect to different WIFI causes app to go deaf

While I was successfully monitoring and controlling my devices, I switched my mobile device from one WIFI hotspot to another. Once reconnected, Blynk buttons and other app-to-device messages worked fine, but nothing from device-to-app worked until I restarted the app.

App version 2.14.6. Android 4.4. Blynk cloud server.

That would make sense as you effectively broke a “secured” link mid-stream, and required restarting the app to reconnect the link as required with the Apps login (even if only in the background, as you probably hadn’t logged out) and projects auth code confirmation via the server… and all in a “new” network.

Think along the lines of dropping a phone call due a dead battery… plugging into a new power source will get the phone back onto the cell system, but will not automatically reconnect the call without someone redialing the number (no not a perfect analogy, as you still had partial link, but I hope you get the point).

Solution, don’t “hang up” midstream :wink: At least close (minimise) the App before switching hotspots, as reopening the App should do the same thing (it does for me as I transition from Local WiFi to cellular data and back).

I have to disagree, at least partially. This isn’t a dropped phone call that needs manual intervention to recover. It’s a data stream. If my mobile switches from cell data to WIFI data as I arrive home, or vice versa as I leave home, my secured web pages that are streaming data don’t suddenly need to be reloaded. Blynk did partially recover and continued to work in one direction (app-to-device), just not both. Blynk apps and devices talk to the Blynk cloud, not directly to each other. And clearly both had connection to the cloud. Seems like a bug at the server end.

1 Like

@BlynkSky, please check if you can reproduce this issue on different wifi networks / maybe different phones, and please report here the results.
thanks!

Yes, I acknowledged all that. However, you switched hotspots mid-connection… Generally your home WiFi and cellular carrier see your device as "authorised’ and do not kick in any fancy firewall settings that could otherwise block suspicious data flow, but you can’t know what other hotspots have. Neither Blynk nor your phone would have control over how that 2nd hotspot seemed to block data transfers from a source (the server) that it did not "authorize’ (as in wasn’t involved in the initial link).

Anyhow, this appears to have been a one time situation, so as @wanek suggested, if you can reliably recreate and document it to some degree, then the Developers might have something to work with.

I have now confirmed the issue, but I have also determined it does not always happen, and there is a third state where the app doesn’t communicate at all. For these tests I used my phone (instead of tablet).

First, with the phone connected to home WIFI and the app showing me a 4Hz update feed, I drove away. When the phone switched to cell data, the feed froze and did not recover on its own. In this scenario I could not tell whether app-to-device messages were also failing.

Second, with the phone connected to cell data and the app showing me a 4Hz update feed, I drove home. When the phone switched to WIFI upon arrival, the app fully reconnected and continued the feed.

Third, just for kicks, I turned the phone’s wifi off for 20 seconds, and then back on for 20 seconds. I kept doing this in 20 second increments, forcing the phone to switch to cell data, and then back to wifi. The first 2-3 times the app reconnected just fine, but then it failed and remained disconnected entirely.

Fourth, I tried to repeat the first test by just walking away from the house. The phone never did fully switch to cell data, but the wifi had a lot of disconnects that eventually disrupted the blynk app. When I walked back into strong wifi signal, the app remained silent. I confirmed that data was not flowing in either direction from my phone, but the tablet was working fine. I then let the phone “sleep”, forcing blynk into the background without killing it. When I woke up the phone, the blynk app reconnected and began partially working again; sending data, but not receiving any (just like my original post, but on a different device). I tried the blynk pushbuttons on both the the phone and the tablet. The device and the tablet both acknowledged blynk buttons pressed on the phone, but the phone did not acknowledge buttons pressed on either the tablet or the device.

So, sometimes the app goes completely offline (and stays that way), and sometimes it goes half offline (and stays that way), and sometimes it traverses these reconnects with no trouble at all. I don’t know how useful that is, but there you have it.

2 Likes

thanks for the effort testing this!

@Dmitriy, @BlynkAndroidDev, could you please confirm if this is expected behaviour or bug?

Hm, a very curious issue.

The app is sending and receiving data via one and same connection, so it should be impossible for it to have problems with receiving data while successfully sending them. What is going on the side of your hardware at that moment, they are also switching somehow via wifi points or not? Also what devices are you using (smartphone and hardware)? What widgets are not receiving data and could you add their read frequency setup?

@Dmitriy any ideas?

maybe, it could be because of some uncommon router / repeater configuration?

answers:
Just 1 device (Adafruit Feather Huzzah esp8266), connected exclusively to home WIFI, close/strong signal.
Home WIFI is Netgear wndr3700; standard router config, reliable, nothing special. Upstream wired to Comcast cable modem/router, but I never use the Comcast supplied wifi. Don’t trust it.
Phone is Samsung Galaxy S4, with Samsung/Verizon flavor of Android 4.4, on Verizon cell network (and/or home WIFI).
Tablet is Nexus 7 (2nd gen), genuine/vanilla Android 4.4 (usually on home WIFI but I can tether it to phone).
All widgets (4) in project are not receiving; 1 LED, 2 buttons, 1 terminal. All using virtual pins. I did not test whether terminal could send or not.

Thanks, will wait for @Dmitriy comment as well

@BlynkAndroidDev This has brought up memories of similar experiences, as in seemingly one-way connection for a short while, (but not while switching networks, as everything was running on an otherwise stable USB-link and wired local network & server connection at the time).

[Solved] Local Server connection and communication issues & Script keeps halting (on MEGA via USB link)

At the time I assumed it was the USB link… however as time goes on and I switched to ESP WiFi… one remaining constant is my older version Android devices and my primarily used Android emulator (running 4.4.4). In hindsight, I can’t ever recall any issues on Android 7.0, mostly on Android 4.x devices.

If it is an issue related to older Android versions, I hope a resolution can be found, short of locking out those versions, as it is still very handy to utilise older devices with Blynk.

@BlynkSky

I’ve prepared a logging build, it could be a little bit slower than ordinary one (especially due to additional log for another resize issue), could you install it and reproduce your issue and then send me a log (from about -> send logs):

Thanks

@BlynkAndroidDev, unfortunately today i experienced the same behaviour:

my phone switched several times (3-4 times) from 2.4ghz to 5ghz wifi (on the same router) and the app presented the exact same issues:

the communication worked only one way: from phone to server it worked perfectly, but didn’t received any data from server to phone. i had to restart the app, than worked ok.

i think you should investigate further this issue, because it seems that not an isolated case…

We are investigating this issue, but it is not easy to reproduce and unfortunately BlynkSky has not tried logging build. I’ll try your scenario.

just keep the app on (with keep screen always on) and toggle 2.4ghz wifi on/off from the router webpage. wait until the phone switches to 5ghz than after a while turn 2.4ghz back on, etc.

i can make some logging if you have a latest build.

Hi, you could try this build: https://www.dropbox.com/s/zl4qmin3nzttlb2/blynk_app_log.apk?dl=0
Also if it’s possible could you check resize not working issue also?

i do not know why/how, but since yesterday resize seems to work ok.

i will check connectivity issue a bit later, i have lots of work now.

1 Like

Could you check the connectivity issue with the latest 2.15.1 build? It should be fixed now.