Add details :
• Hardware model + communication type. For example: Arduino UNO with Ethernet Shield
• Smartphone OS (iOS or Android) + version
• Blynk server or local server
• Blynk Library version
• Add your sketch code. Code should be formatted as example below.
Simply paste your code between ``` If you don’t format your code, your topic can be deleted by moderators.
ESP32 - Aduio IDE
jsonBuffer = httpGETRequest(SERVER_PATH.c_str());
I found that this code takes about 0.4 seconds to run.
If I press a button in the APP while the code is running, Blynk’s connection is clearly disconnected.
Also, it is not frequent, but the connection is disconnected periodically for about 5 seconds. What is the reason?
I guess it depends on how you’re handling the connection to whatever server it is that you’re retrieving data from.
If you’re re-using the connection created by Blynk for your HTTP client then this could cause issues. All speculation without seeing the code and having a clear description of how you’ve configured your datastreams and widgets, and exactly what happens in which situations.
If you use this trick, you can prevent the Blynk link status LED from turning off, but the APP button function will not work anyway, so there is no functional improvement.
There seems to be no way to prevent this issue with a structure that retrieves data from an external server.
If I had to give you one suggestion, I think it would be a good thing if Blynk was notified that a button was pressed on the app and had it run when the connection was restarted.
Not sure if our cases are similar but I do have a device controlled by Blynk that at the same time retrieves info from openweathermap.org using https.GET (without SSL certificate validation). The Blynk connection is not at all impacted by this https.GET. Maybe you could try https iso http?
In addition, this is how I configure WiFi and Blynk during setup:
WiFi.config(ip, dns, gateway, subnet); //I need fixed IP@
Blynk.config(auth, “blynk.cloud”, 80);
As shown in the code below, when the APP button is pressed and the app is automatically executed, if the controller is executing “http.GET()”, Blynk’s connection is disconnected for about 5 to 7 seconds and then reconnected.
This is probably because the controller cannot connect to two servers at the same time.
So, the biggest issue at the moment is that when using Blynk, problems may arise if all data extraction is done externally.
Is it true that there is fundamentally no way to solve it?
So, what I suggest is that at least it would be necessary to send a record of the button pressed before the connection was lost to the Blynk server after the connection is reestablished.
Let’s say that when one controller is connected to Blynk via Wifi with the same SSID and PASS and the controller requests data from a remote PLC server to receive data or send a command, the information about the button pressed in the APP goes to the Blynk server.
However, the controller cannot receive the button-pressed information due to the code executed first, and then the WRITE function cannot be executed, so could the connection be lost momentarily?
What I’m curious about is if this information arrives at the server when the APP button is pressed, but the actual controller does not receive the information within a certain amount of time and cannot be executed, will there be a problem with the Blynk connection between the server and the controller?