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: articles/iot-hub/iot-hub-mqtt-support.md
+11-27Lines changed: 11 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,41 +28,25 @@ A device can use the MQTT protocol to connect to an IoT hub using any of the fol
28
28
* Libraries in the [Azure IoT SDKs](https://github.com/Azure/azure-iot-sdks).
29
29
* The MQTT protocol directly.
30
30
31
-
MQTT protocol uses port 8883. This port is blocked in many corporate and educational networking environments. If you can't open port 8883 in your firewall, we recommend using MQTT over Web Sockets. MQTT over Web Sockets communicates over port 443, which is almost always open in networking environments. When using the Azure IoT SDKs, you typically specify the transport or protocol type in the call to create a client as in the following examples.
The MQTT port (8883) is blocked in many corporate and educational networking environments. If you can't open port 8883 in your firewall, we recommend using MQTT over Web Sockets. MQTT over Web Sockets communicates over port 443, which is almost always open in networking environments. To learn how to specify the MQTT protocol when using the Azure IoT SDKs, see [Using the device SDKs](#using-the-device-sdks).
48
32
49
33
## Using the device SDKs
50
34
51
-
[Device SDKs](https://github.com/Azure/azure-iot-sdks) that support the MQTT protocol are available for Java, Node.js, C, C#, and Python. The device SDKs use the standard IoT Hub connection string to establish a connection to an IoT hub. To use the MQTT protocol, the client protocol parameter must be set to **MQTT**. By default, the device SDKs connect to an IoT Hub with the **CleanSession** flag set to **0** and use **QoS 1** for message exchange with the IoT hub.
35
+
[Device SDKs](https://github.com/Azure/azure-iot-sdks) that support the MQTT protocol are available for Java, Node.js, C, C#, and Python. The device SDKs use the standard IoT Hub connection string to establish a connection to an IoT hub. To use the MQTT protocol, the client protocol parameter must be set to **MQTT**. You can also specify MQTT over Web Sockets in the client protocol parameter. By default, the device SDKs connect to an IoT Hub with the **CleanSession** flag set to **0** and use **QoS 1** for message exchange with the IoT hub.
52
36
53
37
When a device is connected to an IoT hub, the device SDKs provide methods that enable the device to exchange messages with an IoT hub.
54
38
55
-
The following table contains links to code samples for each supported language and specifies the parameter to use to establish a connection to IoT Hub using the MQTT protocol.
39
+
The following table contains links to code samples for each supported language and specifies the parameter to use to establish a connection to IoT Hub using the MQTT or the MQTT over Web Sockets protocol.
|[C#](https://github.com/Azure/azure-iot-sdk-csharp/tree/master/iothub/device/samples)|TransportType.Mqtt| TransportType.Mqtt falls back to MQTT over Web Sockets if MQTT fails. To specify MQTT over Web Sockets only, use TransportType.Mqtt_WebSocket_Only|
47
+
|[Python](https://github.com/Azure/azure-iot-sdk-python/tree/master/azure-iot-device/samples)| Supports MQTT by default| Add `websockets=True` in the call to create the client|
64
48
65
-
### Default keep-alive timeout
49
+
### Default keep-alive timeout
66
50
67
51
In order to ensure a client/IoT Hub connection stays alive, both the service and the client regularly send a *keep-alive* ping to each other. The client using IoT SDK sends a keep-alive at the interval defined in this table below:
0 commit comments