Any news on this? I have the same problem. My first GET succeeds, but all subsequent GETs fail with ‘connection refused’. Here is my function which is called from a timer every 60 seconds. I have also tried calling the function from a button press instead of the timer. The WIFI status is always reported as ‘CONNECTED’. I also have a ‘ESP8266WebServer’ running which is accessible.
kingrolo:
Any news on this? I have the same problem. My first GET succeeds, but all subsequent GETs fail with ‘connection refused’. Here is my function which is called from a timer every 60 seconds. I have also tried calling the function from a button press instead of the timer. The WIFI status is always reported as ‘CONNECTED’. I also have a ‘ESP8266WebServer’ running which is accessible.
Have you found a solution ?
I have the same problem.
I’m getting the same issue. I have 3 instances on the HTTPClient and they all work once only. I’m definitely calling end. https.GET() returns 0 or less and https.errorToString(httpCode).c_str() is connection refused. Everything was fine until I tried to use https and added client->setInsecure(). Snipit below.
if (WiFi.status() == WL_CONNECTED) {// Check WiFi connection status
std::unique_ptrBearSSL::WiFiClientSecureclient(new BearSSL::WiFiClientSecure);
client->setInsecure();
HTTPClient https; // Declare an object of class HTTPClient
https.begin(*client, url); // Specify request destination
int httpCode = https.GET(); //Send the request
if (httpCode > 0) { // Check the returning code
line = https.getString(); // Get the request response payload
} else {
quoteString=String(“HTTPS GET failed, error:”) + https.errorToString(httpCode).c_str();
Serial.println(quoteString);
https.end();
return false;
}
https.end(); //Close connection
// Serial.print(“Response :”); Serial.println(line); // debug info
} else {
quoteString=“Wifi connection failed”;
Serial.println(quoteString);
return false;
}