In our getting started series we have seen how to create our first dashboard and send information using HTTP now we are going to introduce another great protocol named MQTT specially designed for IOT

Introduction

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 minimize 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.

The protocol runs over TCP/IP, or over other network protocols that provide ordered, lossless, bi-directional connections. It is simple, and very easy to implement. Whenever a message is published it gets broadcast to everyone that is subscribed to the topic.

Example:

Imagine a simple network with three clients and a central broker.

All three clients open TCP connections with the broker. Clients B and C subscribe to the topic temperature.

At a later time, Client A publishes a value of 22.5 for topic temperature . The broker forwards the message to all subscribed clients.

The publisher subscriber model allows MQTT clients to communicate one-to-one, one-to-many and many-to-one.

Currently we have implemented,the MQTT V3.1 especification

For more information: https://github.com/mqtt/mqtt.github.io/wiki

ConnectingThings MQTT endpoint

This is a demonstration about how the endpoint looks like in ConnectingThings platform.

Host: app.connectingthings.io  
Topic: key/:key/device/:device/tag/:tag  
Message: {"value":"12"}  
  • Host: is the server connection url.
  • Topic: is composed by the :device parameter that you need to configure at the platform, the :key parameter the authentication key for your user and the sensor :tag parameter.
  • Message:
    • Value: the value representation from the sensor

As you can see is very similar than HTTP, the main advantage as we saw before, is the simplicity ideally for hardware devices.

Here's a quick tutorial showing how to send sensor information to the platform using a MQTT chrome client app



If you don't have an account already ask yours for free! here

And if you need help or you have ideas check out our community

May the code be with you.