To connect your IoT device to HiveMQ Cloud, ensure you have the following:
HiveMQ Cloud Account and Cluster
Create an account and set up a cluster by following the steps in the HiveMQ Cloud Quick Start Guide.Access Credentials
Generate a pair of access credentials as described in the Quick Start Guide.Device Compatibility
Ensure your device supports the following:TLS (Transport Layer Security)
TLS-SNI (Server Name Indication) extension (see What is TLS Server Name Indication?)
Correct hostname, port, and access credentials
CA Certificate
Download and install the required CA certificate from Let's Encrypt.
How to Verify Device Compatibility:
Does your IoT device support TLS?
Check the manufacturer’s IoT device manufacturer's documentation for TLS support.Does your IoT device support TLS-SNI?
Refer to the manufacturer’s IoT device manufacturer's documentation to verify TLS-SNI compatibility.
For Wi-Fi or Ethernet-Connected Devices:
To confirm if TLS-SNI is supported, you can use a network analysis tool:
For example, Wireshark:
...
Capture the network communication on the MQTT port between your device and the broker (in the picture above, it is port 8883).
Analyze the
TLS
handshake (in the picture above, look forTLSv1.2
in the Protocol column; (in the picture above, theCLient Hello
is highlighted with an amber rectangle)).Look for the "
Client Hello
" packet. If it contains the server’s hostname, “Extension: server_name
“, it means that the TLS-SNI is supported (in the picture above, theCLient Hello
packet and theExtension: server_name
are highlighted with amber rectangles).
For Devices Without Wi-Fi or Ethernet:
If your device isn’t locally connected to Wi-Fi or Ethernet, you can simulate a TLS server locally and expose it globallyto Internet. Follow this guide. to detect if your IoT device supports TLS-SNI!
Verifying Hostname, Port, and Access Credentials:
To ensure you are using the correct hostname, port, and credentials:
...
Expand | ||||
---|---|---|---|---|
| ||||
Connect MQTT clientsSubscribeTo connect to your HiveMQ Cloud cluster and subscribe to the topic You are asked for the password for the user
This is your first connected MQTT client, that is subscribed and waiting for incoming messages. PublishTo create another client and send messages to your cluster, open a second terminal window and enter the following command: (keep your original terminal window open)
The message To publish another message, just run the |