MQTTClient component must be added to the CDP system in order to connect and interact with other devices in the MQTT network.
MQTTClient has the following configurable properties:
|Broker host to connect to (IP address or hostname).
|Broker TCP port (usually 1883 for unencrypted and 8883 for encrypted connections)
|User ID for authentication with the broker. Can be empty if the broker allows connections without userID.
|Password for authentication with the broker. Can be empty if the broker allows connections without the password.
|Client ID to use when connecting to the broker. If empty, a random (but same for every component instance on every start) ClientID will be auto-generated.
|Connection keep-alive interval in seconds. The keep-alive functionality assures that the connection with the broker is still open. Defaults to check it after every 60 seconds.
|Connection retry in seconds. Sets the time to wait between unsuccessful connection retries. Defaults to 10 seconds.
|LWT (Last Will and Testament) topic that can be used by other clients to detect this client's connectivity.
|Payload that will be sent to LWTTopic at client connect.
|Payload that will be sent to LWTTopic by the broker after this client connection is lost.
|Broker connection encryption. Choose between options:
|Broker host certificate issuer (CA) file name (used for TLS certificate-based broker verification). See also TLS certificate setup.
|Broker TLS connection verification method flags: when flag H is set, then the client will check that the broker hostname matches the certificate; when flag C is set - then the client will check that the broker certificate is signed using the CA set in TLSBrokerCACertFile. By default, both checks are turned on.
|Client authentication certificate file name (for TLS client authentication). See also TLS certificate setup.
|Client authentication key file name (for TLS client authentication). See also TLS certificate setup.
|TLS-PSK key identity (for TLS-PSK-based encryption/authentication). See also TLS-PSK key setup.
|TLS-PSK key hexadecimal string (for TLS-PSK-based encryption/authentication). See also TLS-PSK key setup.
|Flag to be used for connecting with some MQTT brokers (f.e. AWS) that actively refuse connections with MQTT persistent session facility enabled (cleanSession=false). PS! Be aware that setting DisablePersistentSessions also means that messages received by the broker during client connection failure will not be resent at connection restore (regardless of sender QoS parameter).
|MQTT protocol version to use. Choose between:
MQTTClient state can be observed at runtime via these read-only properties:
|Connection status with the broker.
|The timestamp of the last connection or disconnection.
|The timestamp of the last message sent or received.
|Sent (published) message total count for all topics.
|Received (subscribed) message total count for all topics.
|Maximum number of MQTT v5 topic aliases allowed, that the broker informed during connect handshake
|MQTT v5 topic aliases currently in use
To send/receive data to/from the MQTT network, there are two different possibilities: