MQTT is intended for large networks with low data traffic and designed to minimize data volumes.
Data transfer with MQTT
Data transfer using MQTT takes place over TCP. It may be encrypted with SSL. A “publisher-subscriber” data transfer model is used. This means that messages are exchanged using one central hub (a MQTT broker).
First, the client (a device or a node) establishes a connection to the MQTT broker over TCP. Most often, port 1883 is used, or 8883 for TLS connection.
MQTT broker
A MQTT broker is a central hub (typically in a cloud in the public internet) that connects MQTT publishers with MQTT subscribers. MQTT publishers send messages and MQTT subscribers subscribe to receive the messages. There can be several MQTT subscribers to the same “topic”.
Messages are divided into “topics”; a device may either “publish” a given topic, or “subscribe” to the topic. Within a topic, messages are exchanged as they are received by the MQTT broker and then sent to the subscribed devices.
A device (electrical socket) can be simultaneously a publisher for some topics (publishes the measured values) and a subscriber for other topics (reacts to commands for controlling the output).
MQTT subscriber
A MQTT subscriber receives MQTT messages from the MQTT broker. Messages are categorized into topics that can be subscribed to.
MQTT publisher
A MQTT publisher sends MQTT messages to the MQTT broker.
A MQTT client can publish messages as long as it is connected to a MQTT broker. The MQTT protocol categorizes the messages by the topic. Every message must contain a topic that can be used by the MQTT broker to pass the message on to the subscribed MQTT subscribers. Every message has a payload that is delivered to the subscribers in this way. It can carry any content.
In the context of NETIO products
- NETIO 4x smart sockets use MQTT as the standard M2M API for example to connect to MS Azure cloud solutions or other cloud services.
- MQTT-flex is an extension that enables the user to define the MQTT communication structure.
Useful links:
- For the first steps with MQTT we recommnend AN12 MQTT control of NETIO smart sockets using the HiveMQ broker
- Download Information for developers: NETIO specification of MQTT API
- Application Note: AN40: Getting started with PowerCable MQTT-flex via HiveMQ MQTT broker to mobile App
- Try online demo of NETIO PowerPDU 4C (login: demo/demo)