httpGETRequest(), Blynk's connection is clearly disconnected

Before creating the topic

  1. Search forum for similar topics
  2. Check and
  3. 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. :point_up: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?

Difficult to speculate without seeing your entire code.

It would also help if you clarify what this means…


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.


I am using a connection created by Blynk.
Is there another way to create a connection?

[Unformatted code removed by moderator]

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.

String httpGETRequest(const char* serverName) {  
  WiFiClient client;
  HTTPClient http;    
  http.begin(client, serverName);  
  int httpResponseCode = http.GET();   
  http_Response_Code = httpResponseCode;  
  String payload = "{}";   
  if (httpResponseCode>0) {    
    Serial.print("HTTP Response code: "); Serial.println(httpResponseCode);        
    payload = http.getString();
  else {    
    Serial.print("Error code: "); Serial.println(httpResponseCode);    
  return payload;  

@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.


What connection method are you using? (Blynk.begin or Blynk.config/connect).

Roughly how long does the http call to the PLC server take?
Are the PLC servers on your own network, or accessed via a the web?


I am using Blynk.begin(auth, ssid, pass) for connection of Blynk.

It will take about 2.2 sec as like below timeline.

PLC is located via a the web not local nextwork.

14:04:18.354 → http://???/program.json?pw=???&VAR_F1=5.00&VAR_F2=15.00&VAR_F3=10.00&VAR_F4=0.20&VAR_F2=90.00&VAR_F3=10.00
14:04:18.685 → HTTP Response code: 200
14:04:18.685 → 206 17 92.38%
14:04:19.012 →
14:04:19.012 → http://???/current_state.json?pw=???
14:04:20.557 → HTTP Response code: 200
14:04:20.557 → 207 17 92.41%

Have you considered calling Blynk.disconnect() before your http get and Blynk.connect() afterwards?


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.

It would make sense for you to switch from Blynk.begin to Blynk.config() and Blynk.connect, and manage your own WiFi connection.


Not sure if our cases are similar but I do have a device controlled by Blynk that at the same time retrieves info from 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, “”, 80);
Blynk.connectWiFi(ssid, pass);

Not sure if this is relevant.

Good luck,


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.

  Wind_max = param.asFloat();
  pref.putFloat("Wind_max", Wind_max);
  Blynk.virtualWrite(VPIN_Wind_max, Wind_max);

I don’t believe that this is the case.
Did you try changing from Blynk.begin to Blynk.config/connect ?

What Heartbeat interval is shown in the Device > Device Info screen?

I really don’t understand this at all, can you explain further?…


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?

I would help if you answered my other questions.

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 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%.

I can’t help you if you won’t answer my questions, so I’ll leave you to figure-out a solution.

Of course, if you used Node-Red then you wouldn’t have these problems.