I am using an Arduino UnO Wifi R2. The following code hangs on my Arduino on the call to responseStatusCode() after running my application anywhere from 12-56 hrs. My HTTP endpoint is a REST API using Java Spring Framework deployed on major Cloud Servers. The hang happens against multiple Cloud Servers that includes Azure, Google, Heroku, and AWS. My JSON payload is very small and I have validated I have no memory leaks in my program. The same REST API and backend code has been running with a Raspberry Pi for almost 12 months.
// Send POST request with JSON to Cloud REST API
HttpClient client = HttpClient(wifi, serverAddress, port);
client.setHttpResponseTimeout(60 * 1000);
client.beginRequest();
client.post(uri);
client.sendBasicAuth("MyUsername", "MyPassword");
client.sendHeader("Content-Type", "application/json");
client.sendHeader("Content-Length", json.length());
client.beginBody();
client.print(json);
client.endRequest();
// Read the status code and body of the response
int statusCode = client.responseStatusCode();
String response = client.responseBody();
I am using an Arduino UnO Wifi R2. The following code hangs on my Arduino on the call to responseStatusCode() after running my application anywhere from 12-56 hrs. My HTTP endpoint is a REST API using Java Spring Framework deployed on major Cloud Servers. The hang happens against multiple Cloud Servers that includes Azure, Google, Heroku, and AWS. My JSON payload is very small and I have validated I have no memory leaks in my program. The same REST API and backend code has been running with a Raspberry Pi for almost 12 months.
// Send POST request with JSON to Cloud REST API HttpClient client = HttpClient(wifi, serverAddress, port); client.setHttpResponseTimeout(60 * 1000); client.beginRequest(); client.post(uri); client.sendBasicAuth("MyUsername", "MyPassword"); client.sendHeader("Content-Type", "application/json"); client.sendHeader("Content-Length", json.length()); client.beginBody(); client.print(json); client.endRequest();
// Read the status code and body of the response int statusCode = client.responseStatusCode(); String response = client.responseBody();