Skip to content

mqtt communication with tactigon shape

Stefano Barbareschi edited this page Oct 8, 2026 · 1 revision

MQTT Communication with Tactigon Shape

Tactigon Shape supports communication through the MQTT (Message Queuing Telemetry Transport) protocol. MQTT is a lightweight messaging protocol used to enable communication between devices, applications, and services.

In an MQTT communication system, messages are exchanged through an MQTT broker.

The topic identifies the channel through which messages are exchanged. For example, a message published on the tactigon/test topic can be received by any client subscribed to the same topic.

Tactigon Shape can act both as a Publisher, when sending messages, and as a Subscriber, when receiving messages. Communication can therefore take place in both directions:

Tactigon Shape → MQTT Broker → MQTTX

or:

MQTTX → MQTT Broker → Tactigon Shape

MQTTX

MQTTX is an MQTT client that allows users to connect to an MQTT broker and easily test communication between different devices, applications, and services.

With MQTTX, it is possible to:

  • create a connection to an MQTT broker;
  • Subscribe to a topic;
  • Publish messages to a topic;
  • view received messages;
  • check the content of the payload.

MQTTX can therefore be used as a testing tool to verify MQTT communication with Tactigon Shape.

MQTTX Installation

MQTTX is available for Linux, Windows, and macOS. To download MQTTX, use the official website: Download MQTTX

After installing MQTTX, start the application.

Starting MQTTX on Linux

On Linux, MQTTX can be started from the terminal using: mqttx

if MQTTX does not start correctly with mqttx, use mqttx --ozone-platform=x11 to force the application to use X11.

Once MQTTX is open, proceed with the connection configuration.

Connection Configuration

Create a new MQTT connection and enter the following parameters:

  • Name: standard
  • Host: mqtt://broker.emqx.io
  • Port: 1883

After entering these parameters, the connection to the broker can be established.

For more detailed information on how to connect to an MQTT broker and Subscribe/Publish to MQTT topics, refer to the official MQTTX documentation.

MQTT Broker

To allow MQTTX and Tactigon Shape to exchange messages, an MQTT broker is required.

In this guide, MQTTX and Tactigon Shape connect to the public EMQX broker broker.emqx.io. A local EMQX broker can also be used as an alternative.

The broker is the component that receives messages published by clients and forwards them to clients that are subscribed to the corresponding topic.

The broker therefore acts as an intermediary between the different MQTT clients.

Online and Local Brokers

An MQTT broker can be used in two main ways:

1. Online Broker

The broker runs on a server that is accessible through the Internet. In this case, there is no need to install the broker on your computer.

There are several services that provide public MQTT brokers or free plans for development and testing. An example used in this guide is:

Broker EMQX

Configuration:

  • It is already available online.

  • You do not need to create an account or install anything.

  • You can connect directly using:

    Host: broker.emqx.io

    Port: 1883

Other MQTT Brokers:

  • HiveMQ Cloud Serverless: a free cloud MQTT broker for learning and experimentation, with up to 100 MQTT connections and 10 GB of data traffic per month.

2. Local Broker

An MQTT broker can also be run locally instead of using an online broker. For example, EMQX can be installed and run locally using Docker.

A local broker is useful when you want to have more control over the MQTT environment and do not want to depend on an external service.

For detailed instructions on how to install and configure EMQX locally with Docker, refer to the official documentation:

EMQX – Install with Docker

Note: When using a public MQTT broker, it is important to ensure that the connection is properly configured and that appropriate access permissions are used to prevent unauthorized access and the loss of sensitive data.

To manage these two operations, Tactigon Shape provides specific Blockly blocks, which are described in the following sections.

Message Reception Block:

Screenshot from 2026-08-25 14-07-08

This is the MQTT message reception block. It allows Tactigon Shape to listen for incoming messages on a specific MQTT topic. When a message is received, the blocks inside do are executed.

How are its fields structured?

  • Topic field: Enter the name of the MQTT topic from which you want to receive messages, for example "tactigon/test".
  • payload field: Represents the content of the received MQTT message. The payload can contain a value, text, or structured data such as a JSON object.
  • do section: Contains the blocks that must be executed when a message is received. For example, you can use Get item to extract a specific value from the received data or use if/else blocks to perform threshold checks.

Example: MQTTX → Shape

Objective: Publish a message from MQTTX and receive it in Tactigon Shape.

  1. Configure Tactigon Shape Configure Tactigon Shape to subscribe to the following topic: shape/input When a message is received, use a Debug block to display the payload.
  1. Configure MQTTX Publish a message to: shape/input Use the following payload: "Temperatura": 40

  2. Test Publish the message from MQTTX. Tactigon Shape should receive the message and display the payload in the Debug block: "Temperatura": 40

Screenshot from 2026-08-24 11-50-40 Screenshot from 2026-08-24 11-49-56

Message Publication Block:

Screenshot from 2026-08-25 14-07-21

This is the MQTT message publication block. It allows Tactigon Shape to send data to other MQTT clients or services through a specific MQTT topic.

How are its fields structured?

  • publish payload field: Contains the data that will be sent. It can be a value, a variable, a dictionary, or JSON data. If a dictionary containing key/value pairs must be sent as JSON, it can be converted using the appropriate JSON block, such as jsonify.
  • on topic field: Specifies the MQTT topic to which the message is published, for example "shape/input" or "zion/data".

Example: Shape → MQTTX

Objective: Create a Tactigon Shape program that publishes a message to an MQTT topic and verify that the message is correctly received in MQTTX.

Configure MQTTX to subscribe to the following topic: shape/test

Uses the following payload: Hello from Zion

Screenshot from 2026-08-24 11-16-17 Screenshot from 2026-08-24 11-17-37

To practice what you have learned, see the Exercises

Clone this wiki locally