Connecting to the MQTT broker
To establish a connection with an client to the MQTT broker, follow these steps:
Broker Address
Obtain the IP address or DNS entry of the MQTT broker. It will typically follow the format
[p].mqtt.netilion.endress.com
or
[p].mqtt.staging-env.netilion.endress.com
Secure Connection
Ensure that your client supports TLS/SSL to encrypt the communication.
Connect using the appropriate port
- For MQTT TLS, use port 8883
- For Secure WebSockets, use port 8884
Authentication
Username/Password
If using username and password authentication, ensure that the credentials are correctly configured in your client.
Client Certificate
For certificate-based authentication, install the client certificate as per the broker’s requirements.
Client Configuration
Configure your MQTT client with the broker’s address, port, and authentication details.
Set the desired Quality of Service (QoS) level for message delivery.
Connection Initiation
Use your MQTT client to initiate the connection.
Handle any connection errors or retries as per your application’s logic.
Subscription
Once connected, subscribe to the necessary topics to receive messages.
Ensure that your client is authorized to access the topics it subscribes to.
Publishing Messages
Publish messages to the broker on the relevant topics.
Verify that the messages are correctly formatted and sent with the correct QoS level.
Monitoring & Troubleshooting
Monitor the connection for any disruptions or errors.
Implement logging and error-handling mechanisms to troubleshoot potential issues.
By following these steps, clients can securely and reliably connect to an MQTT broker, ensuring efficient communication in your IoT ecosystem.