MQTT tutorial

MQTT stands for MQ Telemetry Transport. It is a publish/subscribe, extremely simple and lightweight messaging protocol, designed for constrained devices and low-bandwidth, high-latency or unreliable networks. The design principles are to minimise network bandwidth and device resource requirements whilst also attempting to ensure reliability and some degree of assurance of delivery. These principles also turn out to make the protocol ideal of the emerging “machine-to-machine” (M2M) or “Internet of Things” world of connected devices, and for mobile applications where bandwidth and battery power are at a premium.

So, we are providing you with our MQTT server to help communicate with your devices.

Example project


Arduino MQTT integration
You can easily use MQTT in your Arduino project based on this example.


Step 0: Your short identifier

First of all, you will need your short identifier many times, locate it.

Also, you will need the short identifier and the key of one of your devices, locate it.


Step 1: Explore how to connect

To open connect to our MQTT server, you can choose from two protocols and two security schemes each.

MQTT

Default and widely supported protocol but communication is not secure.

  • Server name: mqtt.iotguru.live
  • Server port: 1883

Secure MQTT

Less supported protocol but communication is secure.

  • Server name: mqtt.iotguru.live
  • Server port: 8883

MQTT over WebSocket

Packets encapsulated by WebSocket frames but communication is not secure.

  • Server name: mqtt.iotguru.live
  • Server port: 80

MQTT over Secure WebSocket

Packets encapsulated by WebSocket frames but communication is secure.

  • Server name: mqtt.iotguru.live
  • Server port: 443

Step 2: Choose authentication

We provide two authentication schemes to you, you can choose one of them or both of them.

User credentials

Connect to MQTT server with your personal credentials and you can use it in a secure environment.

  • User name: user short identifier
  • Client id: user short identifier + something unique whatever
  • Password: your actual password

Device credentials

Connect to MQTT server with one of your device credentials and you can use it in an insecure environment.

  • User name: user short identifier
  • Client id: device short identifier
  • Password: device key

Step 3: Subscribe and publish on topics

You can access only your own topics, starts with your short identifier.

  • Subscribe: sub/{user short identifier}/#
  • Publish: pub/{user short identifier}/{device short identifier}/{field name}
We will route your published messages from pub/* topic to sub/* topic.

Step 4: Connection example

You can try to connect with the PAHO online MQTT over WebSocket test client.