You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: includes/iot-hub-howto-cloud-to-device-messaging-dotnet.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,8 +17,6 @@ There are two options that a device client application can use to receive messag
17
17
***Callback**: The device application sets up an asynchronous message handler method that is called immediately when a message arrives.
18
18
***Polling**: The device application checks for new IoT Hub messages using a code loop (for example, a `while` or `for` loop). The loop executes continually, checking for messages.
To receive callback cloud-to-device messages in the device application, the application must connect to the IoT Hub and set up a callback listener to process incoming messages. Incoming messages to the device are received from the IoT Hub message queue.
This section describes how to receive cloud-to-device messages using the [DeviceClient](/java/api/com.microsoft.azure.sdk.iot.device.deviceclient) class from the Azure IoT SDK for Java.
14
14
15
-
For a Java-based device application to receive cloud-to-device messages, it must connect to IoT Hub, then set up a callback listener and message handler to process incoming messages from IoT Hub. The device application should also be able to detect and handle disconnects in case the device-to-IoT Hub message connection is broken.
15
+
For a Java-based device application to receive cloud-to-device messages, it must connect to IoT Hub, then set up a callback listener and message handler to process incoming messages from IoT Hub.
16
16
17
17
### Import Azure IoT Java SDK libraries
18
18
@@ -31,6 +31,8 @@ A device app can authenticate with IoT Hub using the following methods:
**HandleMessages**: a sample device app included with the [Microsoft Azure IoT SDK for Java](https://github.com/Azure/azure-iot-sdk-java/tree/main/iothub/device/iot-device-samples), which connects to your IoT hub and receives cloud-to-device messages.
159
161
160
-
## Send cloud-to-device messages from a backend application
162
+
## Create a backend application
161
163
162
164
This section describes how to send a cloud-to-device message using the [ServiceClient](/java/api/com.azure.core.annotation.serviceclient) class from the Azure IoT SDK for Java. A solution backend application connects to an IoT Hub and messages are sent to IoT Hub encoded with a destination device. IoT Hub stores incoming messages to its message queue, and messages are delivered from the IoT Hub message queue to the target device.
163
165
@@ -196,7 +198,7 @@ You can connect a backend service to IoT Hub using the following methods:
196
198
197
199
#### Connect using a shared access policy
198
200
199
-
#### Define the connection protocol
201
+
#####Define the connection protocol
200
202
201
203
Use [IotHubServiceClientProtocol](/java/api/com.microsoft.azure.sdk.iot.service.iothubserviceclientprotocol) to define the application-layer protocol used by the service client to communicate with an IoT Hub.
202
204
@@ -206,7 +208,7 @@ Use [IotHubServiceClientProtocol](/java/api/com.microsoft.azure.sdk.iot.service.
### Open the connection between application and IoT Hub
220
+
#####Open the connection between application and IoT Hub
219
221
220
222
[open](/java/api/com.microsoft.azure.sdk.iot.service.serviceclient?#com-microsoft-azure-sdk-iot-service-serviceclient-open()) the AMQP sender connection. This method creates the connection between the application and IoT Hub.
Copy file name to clipboardExpand all lines: includes/iot-hub-howto-cloud-to-device-messaging-python.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ pip install azure-iot-device
22
22
23
23
For a Python-based device application to receive cloud-to-device messages, it must connect to IoT Hub and then set up a callback message handler to process incoming messages from IoT Hub.
24
24
25
-
### Device import statements
25
+
### Device import statement
26
26
27
27
Add this code to import the `IoTHubDeviceClient` functions from the azure.iot.device SDK.
28
28
@@ -34,15 +34,11 @@ from azure.iot.device import IoTHubDeviceClient
34
34
35
35
A device app can authenticate with IoT Hub using the following methods:
`IoTHubDeviceClient` will by default attempt to reestablish a dropped connection. Reconnection behavior is governed by the `IoTHubDeviceClient`[connection_retry](/python/api/azure-iot-device/azure.iot.device.iothubdeviceclient?#azure-iot-device-iothubdeviceclient-on-message-received) and `connection_retry_interval` parameters.
0 commit comments