Hyper Text Transfer Protocol Secure (HTTPS)
HTTPS is one of the application protocols used for communicating between device-to-cloud and cloud-to-device. When you are using HTTP, devices poll IoT Hub for messages.
The HTTP protocol works for the command/response IoT system between the IoT device and the cloud application.
How to do it...
We will create a simulator and ingest data to IoT Hub:
- Create a device simulator to send a message to the IoT:
deviceClient = DeviceClient.CreateFromConnectionString("HostName=IoTHubCookBook.azure-devices.net;DeviceId=myFirstDevice;SharedAccessKey=XXXXXXXXXXXXX", TransportType.Http1); new DeviceSimulator().SendDeviceToCloudMessagesAsync(deviceClient, "myFirstDevice");
- Send IoT Hub messages using HTTP:
public async void SendDeviceToCloudMessagesAsync(DeviceClient deviceClient1, string deviceId) public async void SendDeviceToCloudMessagesAsync(DeviceClient deviceClient1, string deviceId) { double avgWindSpeed = 10; // m/s Random rand...