In order to use MQTT central broker has to be choosen first. All the connection handling, buffering and re-delivery trying (at network interrupts) is managed by MQTT broker. All MQTT clients have a permanently open TCP connection to the broker.
In general, two different alternatives exist:
- to use some existing broker service (f.e. cloud broker):
- easier to start with - all broker set up and maintenance is done by third-party (service provider)
- more secure to use over Internet (no need to open your network to incoming TCP connections)
- to set up and use your own broker:
- reliability and security is under your control
- no sign up nor agreements needed with third-parties (service providers)
CDP has a simple MQTT broker component built-in.
To use CDP built-in MQTT broker MQTTBroker subcomponent must be added to CDP application.
MQTTBroker has following configurable properties:
|ListenAddress||Address broker listens on (IP or hostname). Use '0.0.0.0' to listen on all network interfaces.|
|ListenPort||TCP port broker listens on (recommended values are 1883 for unencrypted and 8883 for encrypted connections)|
|Encryption||Broker connection encryption. Choose between options:|
|TLSCAFile||Broker CA certificate file name for TLS encryption. See also TLS certificate setup.|
|TLSCertFile||Client authentication certificate file name (for TLS client authentication). See also TLS certificate setup.|
|TLSKeyFile||Broker key file name for TLS encryption (PEM certificate or PSK list). See also TLS certificate setup and TLS-PSK key setup|