Board: ESP8266MOD module from AI Thinker.
Using ArduinoHttpClient I am unable to send a post message to an Azure IOT Hub endpoint. The endpoint is listening on 443 and expects a shared key passed via a custom header.
The error I get is "Connection Timed Out"
Here is the brief sketch
char serverAddress[] = "myapp.azure-devices.net";
int port = 443;
string sig = "Azure shared access signature";
HttpClient client = HttpClient(wifiClient, serverAddress, port);
String jsonPayload = payload; // passed into this function
client.beginRequest();
String contentType = "application/json";
client.post("/devices/deviceId/messages/events?api-version=2016-02-03");
client.sendHeader(HTTP_HEADER_CONTENT_TYPE, contentType);
client.sendHeader("Authorization", sig);
client.sendHeader(HTTP_HEADER_CONTENT_LENGTH, jsonPayload.length());
client.beginBody();
client.print(jsonPayload);
client.endRequest();
statusCode = client.responseStatusCode();
response = client.responseBody();
The Status Code is -3 indicating a Timeout
I then created a simple REST API that accepts the JSON. Hosted it as an Azure website on port 80.
The board is able to connect to this HTTP endpoint
Question(s): 1. Is the board underpowered to handle HTTPS? 2. Is creating an HTTP proxy the only option? 3. Am I not using the right library?
Thanks