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.
void loop()
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?
As I checked the related codes one by one, I confirmed that the problematic code when the button was pressed in the APP was payload = http.getString().
In the end, if you press the APP button during the data retrieval process, is it true that the Blynk connection is disconnected?
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.
please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly. Triple backticks look like this: ```
What HTTP connection does Blynk use?
And of course I get data from other PLC servers.
When sending a command to receive data from the PLC server, the Blynk connection is disconnected.
@wykim92 Please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```
Copy and paste these if you can’t find the correct symbol on your keyboard.
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);
Blynk.connectWiFi(ssid, pass);
Blynk.connect();
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?
Data sent from widgets on the mobile or web dashboards will be forwarded on to the relevant device if it’s online. This happens when the Blynk.run command executes.
If the device is offline then the data doesn’t get sent, but the last value for a datastream can be requested via Blynk.syncVirtual(Vpin).
Neither ‘Begin’ nor ‘cofing, connect’ will solve the problem.
Blynk.synAll(); Also, there is no information about the last button, so I have to set it again when connected. If I press it again and it disconnects, I have to set it again when I reconnect.
Connection to an external PLC must be made at least once every 5 seconds, and since it takes about 2 seconds, the probability of Blynk being disconnected is about 40%.