diff --git a/src/AgApiClient.cpp b/src/AgApiClient.cpp index 8de2596e..6eedcc9c 100644 --- a/src/AgApiClient.cpp +++ b/src/AgApiClient.cpp @@ -58,7 +58,8 @@ bool AgApiClient::fetchServerConfiguration(void) { } #else HTTPClient client; - client.setTimeout(timeoutMs); + client.setConnectTimeout(timeoutMs); // Set timeout when establishing connection to server + client.setTimeout(timeoutMs); // Timeout when waiting for response from AG server if (apiRootChanged) { // If apiRoot is changed, assume not using https if (client.begin(uri) == false) { @@ -133,7 +134,8 @@ bool AgApiClient::postToServer(String data) { } #else HTTPClient client; - client.setTimeout(timeoutMs); + client.setConnectTimeout(timeoutMs); // Set timeout when establishing connection to server + client.setTimeout(timeoutMs); // Timeout when waiting for response from AG server if (apiRootChanged) { // If apiRoot is changed, assume not using https if (client.begin(uri) == false) { diff --git a/src/AgApiClient.h b/src/AgApiClient.h index 9f39cebf..8e52e76f 100644 --- a/src/AgApiClient.h +++ b/src/AgApiClient.h @@ -31,7 +31,7 @@ class AgApiClient : public PrintLog { bool getConfigFailed; bool postToServerFailed; bool notAvailableOnDashboard = false; // Device not setup on Airgradient cloud dashboard. - uint16_t timeoutMs = 10000; // Default set to 10s + uint16_t timeoutMs = 15000; // Default set to 15s public: AgApiClient(Stream &stream, Configuration &config);