MqttBroker

Description

The MqttBroker object creates an MQTT broker listening for connections. An MQTT broker manages the exchange of subscribed and published topics for all connected clients.

› Inherits:Object

Properties

aclFile

This property holds the path to Mosquitto ACL file managed externally via mosquitto_passwd. See the mosquitto.conf man page for details.

This property was introduced in InCore 2.3.

› Type:String
› Signal:aclFileChanged()
› Attributes:Writable

allowAnonymous

This property holds whether clients that connect without providing a username are allowed to connect.

This property was introduced in InCore 2.3.

› Type:Boolean
› Default:true
› Signal:allowAnonymousChanged()
› Attributes:Writable

enabled

This property holds whether the broker is enabled. If set to false the broker process is stopped.

› Type:Boolean
› Default:true
› Signal:enabledChanged()
› Attributes:Writable

internal

This property holds whether the broker should listen for incoming connections on the local loopback interface only. If set to true the broker will not be reachable by other hosts on the network but internal clients such as docker containers (DockerContainer) only.

› Type:Boolean
› Default:true
› Signal:internalChanged()
› Attributes:Writable

maxConnections

This property holds the maximum number of connections which the broker is allowed to manage concurrently.

› Type:SignedInteger
› Default:-1
› Signal:maxConnectionsChanged()
› Attributes:Writable, Optional

passwordFile

This property holds the path to Mosquitto password file managed externally via mosquitto_passwd. See the mosquitto_passwd man page for details.

This property was introduced in InCore 2.3.

› Type:String
› Signal:passwordFileChanged()
› Attributes:Writable

port

This property holds the TCP port number which the broker is listening at for incoming connections.

› Type:SignedInteger
› Default:1883
› Signal:portChanged()
› Attributes:Writable

tlsCaFile

This property holds the path to a TLS/SSL CA file used when establishing encrypted connections to the broker via secure Websockets.

This property was introduced in InCore 2.3.

› Type:String
› Signal:tlsCaFileChanged()
› Attributes:Writable

tlsCertificateFile

This property holds the path to a TLS/SSL certificate file used when establishing encrypted connections to the broker via secure Websockets.

This property was introduced in InCore 2.3.

› Type:String
› Signal:tlsCertificateFileChanged()
› Attributes:Writable

tlsCiphers

This property holds the list of allowed TLS/SSL ciphers for secure Websockets connections, each separated with a colon. Available ciphers can be obtained using the openssl ciphers command.

This property was introduced in InCore 2.3.

› Type:String
› Signal:tlsCiphersChanged()
› Attributes:Writable

tlsKeyFile

This property holds the path to a TLS/SSL key file used when establishing encrypted connections to the broker via secure Websockets.

This property was introduced in InCore 2.3.

› Type:String
› Signal:tlsKeyFileChanged()
› Attributes:Writable

websocketsPort

This property holds the network port number at which to listen for Websockets connections.

This property was introduced in InCore 2.3.

› Type:SignedInteger
› Default:-1
› Signal:websocketsPortChanged()
› Attributes:Writable

Example

import InCore.Foundation 2.5
import InCore.Mqtt 2.5

Application {

    name: "MqttBrokerExample"

    Settings {
        id: settings
        property bool brokerEnabled : true;
    }

    // start an MQTT broker if enabled via settings
    MqttBroker {
        enabled: settings.brokerEnabled
        internal: false
    }
}