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: documents/MQTT5_Userguide.md
+15-13Lines changed: 15 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@
8
8
*[Not Supported](#not-supported)
9
9
*[Getting Started with MQTT5](#getting-started-with-mqtt5)
10
10
*[Connecting to AWS IoT Core](#connecting-to-aws-iot-core)
11
-
*[How to create a MQTT5 Client based on desired connection method](#how-to-create-a-mqtt5-client-based-on-desired-connection-method)
11
+
*[How to create an MQTT5 Client based on desired connection method](#how-to-create-a-mqtt5-client-based-on-desired-connection-method)
12
12
*[Direct MQTT with X509-based mutual TLS](#direct-mqtt-with-x509-based-mutual-tls)
13
13
*[Direct MQTT with Custom Authentication](#direct-mqtt-with-custom-authentication)
14
14
*[Direct MQTT with PKCS11 Method](#direct-mqtt-with-pkcs11-method)
@@ -27,7 +27,7 @@
27
27
28
28
## **Introduction**
29
29
30
-
This user guide is designed to act as a reference and guide for how to use MQTT5 with the Python SDK. This guide includes code snippets for how to make a MQTT5 client with proper configuration, how to connect to AWS IoT Core, how to perform operations and interact with AWS IoT Core through MQTT5, and some best practices for MQTT5.
30
+
This user guide is designed to act as a reference and guide for how to use MQTT5 with the Python SDK. This guide includes code snippets for how to make an MQTT5 client with proper configuration, how to connect to AWS IoT Core, how to perform operations and interact with AWS IoT Core through MQTT5, and some best practices for MQTT5.
31
31
32
32
If you are completely new to MQTT, it is highly recommended to check out the following resources to learn more about MQTT:
33
33
@@ -65,12 +65,12 @@ Not all parts of the MQTT5 spec are supported by the implementation. We current
65
65
66
66
## **Getting Started with MQTT5**
67
67
68
-
This section covers how to use MQTT5 in the Python SDK. This includes how to setup a MQTT5 builder for making MQTT5 clients, how to connect to AWS IoT Core, and how to perform the operations with the MQTT5 client. Each section below contains code snippets showing the functionality in Python.
68
+
This section covers how to use MQTT5 in the Python SDK. This includes how to setup an MQTT5 builder for making MQTT5 clients, how to connect to AWS IoT Core, and how to perform the operations with the MQTT5 client. Each section below contains code snippets showing the functionality in Python.
69
69
70
70
## **Connecting To AWS IoT Core**
71
71
We strongly recommend using the AwsIotMqtt5ClientConfigBuilder class to configure MQTT5 clients when connecting to AWS IoT Core. The builder simplifies configuration for all authentication methods supported by AWS IoT Core. This section shows samples for all of the authentication possibilities.
72
72
73
-
## **How to create a MQTT5 Client based on desired connection method**
73
+
## **How to create an MQTT5 Client based on desired connection method**
74
74
### **Optional Keyword Arguments**
75
75
All lifecycle events and the callback for publishes received by the MQTT5 Client should be added to the builder on creation of the Client. A full list of accepted arguments can be found in the API guide.
76
76
#### **Direct MQTT with X509-based mutual TLS**
@@ -123,7 +123,7 @@ In both cases, the builder will construct a final CONNECT packet username field
123
123
124
124
#### **Direct MQTT with PKCS11 Method**
125
125
126
-
AMQTT5 direct connection can be made using a PKCS11 device rather than using a PEM encoded private key, the private key for mutual TLSis stored on a PKCS#11 compatible smart card or Hardware Security Module (HSM). To create a MQTT5 builder configured for this connection, see the following code:
126
+
AnMQTT5 direct connection can be made using a PKCS11 device rather than using a PEM encoded private key, the private key for mutual TLSis stored on a PKCS#11 compatible smart card or Hardware Security Module (HSM). To create an MQTT5 builder configured for this connection, see the following code:
127
127
128
128
```python
129
129
# other builder configurations can be added using **kwargs in the builder
@@ -146,7 +146,7 @@ A MQTT5 direct connection can be made using a PKCS11 device rather than using a
146
146
147
147
#### **Direct MQTT with PKCS12 Method**
148
148
149
-
AMQTT5 direct connection can be made using a PKCS12file rather than using a PEM encoded private key. To create aMQTT5 builder configured for this connection, see the following code:
149
+
AnMQTT5 direct connection can be made using a PKCS12file rather than using a PEM encoded private key. To create anMQTT5 builder configured for this connection, see the following code:
150
150
151
151
```python
152
152
# other builder configurations can be added using **kwargs in the builder
@@ -185,9 +185,9 @@ any additional configuration:
185
185
186
186
#### **MQTT over Websockets with Cognito authentication**
187
187
188
-
A MQTT5 websocket connection can be made using Cognito to authenticate rather than the AWS credentials located on the device or via key and certificate. Instead, Cognito can authenticate the connection using a valid Cognito identity ID. This requires a valid Cognito identity ID, which can be retrieved from a Cognito identity pool. A Cognito identity pool can be created from the AWS console.
188
+
An MQTT5 websocket connection can be made using Cognito to authenticate rather than the AWS credentials located on the device or via key and certificate. Instead, Cognito can authenticate the connection using a valid Cognito identity ID. This requires a valid Cognito identity ID, which can be retrieved from a Cognito identity pool. A Cognito identity pool can be created from the AWS console.
189
189
190
-
To create a MQTT5 builder configured for this connection, see the following code:
190
+
To create an MQTT5 builder configured for this connection, see the following code:
191
191
192
192
```python
193
193
# The signing region. e.x.: 'us-east-1'
@@ -213,8 +213,8 @@ To create a MQTT5 builder configured for this connection, see the following code
213
213
**Note**: A Cognito identity ID is different from a Cognito identity pool ID and trying to connect with a Cognito identity pool ID will not work. If you are unable to connect, make sure you are passing a Cognito identity ID rather than a Cognito identity pool ID.
214
214
215
215
#### **Direct MQTT with Windows Certificate Store Method**
216
-
A MQTT5 direct connection can be made with mutual TLS with the certificate and private key in the Windows certificate
217
-
store, rather than simply being files on disk. To create a MQTT5 builder configured for this connection, see the
216
+
An MQTT5 direct connection can be made with mutual TLS with the certificate and private key in the Windows certificate
217
+
store, rather than simply being files on disk. To create an MQTT5 builder configured for this connection, see the
218
218
following code:
219
219
220
220
```python
@@ -317,16 +317,18 @@ The Unsubscribe operation takes a description of the UNSUBSCRIBE packet you wish
317
317
```
318
318
319
319
### Publish
320
-
The Publish operation takes a description of the PUBLISH packet you wish to send and returns a future of polymorphic value. If the PUBLISH was a QoS 0 publish, then the future result is an empty PUBACK packet with all members set to None and is completed as soon as the packet has been written to the socket. If the PUBLISH was a QoS 1 publish, then the future result is a PUBACK packet value and is completed as soon as the PUBACK is received from the broker. If the operation fails for any reason before these respective completion events, the future result raises an exception.
320
+
The Publish operation takes a description of the PUBLISH packet you wish to send and returns a future of polymorphic value. The future will result in a PublishCompletionData containing a PUBACK packet. If the PUBLISH was a QoS 0 publish, then the PUBACK packet will be empty with all members set to None and is completed as soon as the packet has been written to the socket. If the PUBLISH was a QoS 1 publish, then the PUBACK packet will contain a reason_code and potentially a reason_string and user_properties if the broker has assigned them any values and is completed as soon as the PUBACK is received from the broker. If the operation fails for any reason before these respective completion events, the future result raises an exception.
0 commit comments