Getting started

The MQTT (MQ Telemetry Transport) driver allows you to use a lightweight messaging protocol that operates seamlessly over the TCP/IP protocol. This driver employs a publish-subscribe model, making it both open and straightforward to integrate into your applications. You can connect up to thousands of remote clients to a single server, enabling efficient data transmission and communication across your network.

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.