Stop the war

Support Ukraine

Try it now Pricing
MQTT Broker
Community Edition Professional Edition Cloud Edge PE Edge IoT Gateway License Server Trendz Analytics Mobile Application PE Mobile Application MQTT Broker
Documentation Installation Architecture API FAQ

On this page

Getting started with TBMQ


The goal of this tutorial is to showcase the fundamental usage of TBMQ. Through this tutorial, you will gain knowledge and proficiency in the following areas:

  • Establishing connections between MQTT clients and the broker.
  • Publishing MQTT messages.
  • Subscribing to topics to receive published messages.
  • Configuring authentication and authorization mechanisms for MQTT clients.

For more comprehensive information regarding the architecture of TBMQ, navigate to the following document. This resource will provide you with detailed insights into the underlying structure and design principles of the broker, allowing you to develop a deeper understanding of its inner functionalities.

Installing TBMQ

To obtain detailed instructions on how to install TBMQ on different platforms, we recommend exploring the Installation options documentation. This resource will provide you with step-by-step guidance tailored to various deployment scenarios.

For Linux users who have Docker installed, the execution of the following commands is recommended:

wget && sudo chmod +x && ./

Once the installation process is complete for local deployment, you can access TBMQ UI by visiting the following URL: http://localhost:8083. Wait patiently until the services are up and running. To log in, utilize the following default credentials.




Configure client authentication & authorization

In order to secure the connection to the broker we should enable Basic or TLS authentication. In this tutorial, we will focus on the Basic authentication type. For this, we have set SECURITY_MQTT_BASIC_ENABLED environment variable to true in the docker-compose.yml downloaded in the previous step.

Once Basic authentication is enabled, it is necessary to create MQTT Client Credentials of type Basic to authenticate and validate the connecting client.

  • Navigate to “Credentials” tab, click “+” in the top right corner of the table.
  • Input credentials name. For example, “Getting Started Credentials”.
  • Input “username” and “password” with chosen values. For example, use username and password values respectively.
  • Authorization rules are set to allow publishing/subscribing to any topic by default.
  • Click “Add” to save credentials.

A wider range of authentication methods can be found within the security guide, offering enhanced options for ensuring secure access.

Publishing and Subscribing to Topics

Now, let’s proceed with publishing messages and subscribing to topics to observe the flow of messages. In this tutorial, we will utilize Mosquitto clients for this purpose.

sudo apt install -y mosquitto-clients

Please refer to the following links to learn how to publish messages to a topic and subscribe to topics in order to receive messages.

Subscribe to topic

To subscribe to the sensors/temperature topic and start receiving messages from TBMQ, you can utilize the following command:

mosquitto_sub -d -h $THINGSBOARD_MQTT_BROKER_HOST_NAME -p 1883 -t sensors/temperature -q 1 -u username -P password

Note, replace the $THINGSBOARD_MQTT_BROKER_HOST_NAME with the correct public IP address or DNS name of the broker, username and password values according to the specified ones in the provisioned credentials. Kindly replicate the aforementioned process for publishing the message below.

Use the following command for local deployment:

mosquitto_sub -d -h localhost -p 1883 -t sensors/temperature -q 1 -u username -P password

Upon successful establishment of the connection, we can proceed to examine the session information within the UI.

Publish message

To publish a message to TBMQ for the topic sensors/temperature, you can utilize the following command:

mosquitto_pub -d -h $THINGSBOARD_MQTT_BROKER_HOST_NAME -p 1883 -t sensors/temperature -m 32 -q 1 -u username -P password

Use the following command for local deployment:

mosquitto_pub -d -h localhost -p 1883 -t sensors/temperature -m 32 -q 1 -u username -P password


You should receive and observe the published message for the subscribed client.


Next Steps