MQTT (MQ Telemetry Transport) driver supports a lightweight messaging protocol for use on top of the TCP/IP protocol driver
installation. Its publish-subscribe architecture is designed to be open and easy to implement with up to thousands of remote
clients capable of being supported by a single server.
Publish and subscribe
The MQTT protocol is based on the principle of publish and subscribe. Multiple clients connect to a broker and subscribe to
topics that they are interested in. Clients also connect to the broker and publish messages to topics. MQTT restricts one
subscriber to one topic.
Client
The term client refers either to a publisher or a subscriber. The MQTT client can be both a publisher and a subscriber at
the same time. An MQTT client is any device from a micro controller up to a full-fledged server that has an MQTT library running
and is connected to an MQTT broker over any type of network. The
Niagara solution for MQTT configures only the client, and not the broker. Data types supported by the client are Boolean, string,
numeric and enum.
Broker
The broker is the central hub for messages. Depending on the actual implementation, a broker may handle many concurrently-connected
MQTT clients. The broker is primarily responsible for:
- Authenticating each client
- Receiving all messages
- Filtering messages
- Deciding which subscriber is interested in each message
- Sending each message to its subscribed client
Most brokers are extensible, providing easily integrated, custom authentication, authorization and integration into back-end
systems. Integration is an especially important aspect because often the broker is the component that is directly exposed
to the Internet. The broker handles multiple clients and passes messages to downstream analyzing and processing systems. The
Niagara The MQTT client supports a TLS connection to a broker, also using login credentials.
Devices
The MQTT driver supports these devices:
- The DefaultMqttDevice represents a generic MQTTNiagara client, which you can use to connect to any broker.
- The AwsMqttDevice connects an MQTT client to the AWS IoT Hub.
- The GcpMqttDevice connects the MQTT client to the Google Cloud Platform.
Authenticators
The MQTT authenticators plug in to the MQTT device according to establish a secure connection between a broker and a client
device. You choose which authenticator to use for each device.
The driver provides these authenticators:
- The generic DefaultAuthenticator serves most devices, providing ways to connect to a broker.
- The AwsIoTAuthenticator makes a secure connection to the AWS IoT (Amazon Web Services Internet of Things) using the certificate authentication.
- The GcpAuthenticator authenticates a secure connection between a client device and a broker on a Google Cloud Platform. It uses RSA keys.