I'm trying to make an HTTP request with an ESP8266 and the ESP8266HTTPClient library. I have a request in the loop() function that makes a request every 5 seconds which works 100% flawlessly. However, I also have an interrupt setup like so:
void interrupt() {
if(WiFiMulti.run() == WL_CONNECTED) {
Serial.println("Knock!");
HTTPClient http;
knockhttp.begin(http_address + "/knock");
int httpCode = http.GET();
if(httpCode > 0) {
Serial.println(http.getString());
} else {
Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
}
http.end();
}
}
This fails. I get a "connection refused" Error every time the interrupt triggers. It's connecting to the same server as the request in the loop, just a different path.