MQTT : the open road to internet of things

| 2 Comments | 4 minutes read

In a nutshell …

MQTT (Message Queue Telemetry Transport) was originally developed by IBM and its partners from the industrial sector (Dr Andy Stanford-Clark of IBM, and Arlen Nipper of Eurotech, in 1999). Since, the protocol has been opened to open source community and has significant growth in popularity, as mobile applications have taken off (version 3.1 of the protocol has been posted in 2010). Now there is a will of making a standard : http://mqtt.org/2013/02/mqtt-proposed-as-an-oasis-standard

The aims of MQTT are focused on providing publish/subscribe messaging system and was specifically designed for constrained environment and devices (low resources, low bandwidth, high latency or weak networks, satellite links … ). More precisely, one of the main target is to be used in embedded systems, connecting “smart” things to the IT world.

The interesting aspects of this protocol :

  • Simple API : connect, publish, (un)subscribe, disconnect
  • pub/sub and push approach
  • Compact binary packet payload (much less verbose than text-based protocol like HTTP) – Smallest possible packet size is 2 bytes
  • Quality Of Service
  • support for loss of contact between client and server (“Last will” feature, to publish a message if the client goes offline)
  • Handle “durable” subscriptions
  • Agnostic : simple binary payload (no special data format needed)

The QOS management offers three qualities of service:

  • QOS 0 : “fire and-forget”. Message is simply send. No care if it has been received.
  • QOS 1 : “at least once”. Ensure to be sent a minimum of one time (but might be sent more than one time)
  • QOS 2 : “exactly once”. Multi deterministic message delivery to reflect tradeoffs between bandwidth, availability, and delivery guarantees.

Actual open source landscape

Publishing the protocol to the open source world is a good step to help adoption by device vendors, software makers and helps widely to extend its support. This clearly helps bringing new platforms, technologies and networks that are driven by different problematics (cost, used technology and physical constraints).

Number of open source libraries & platforms are available. I have played with some of them, through Spring Amqp Integration  :

Libraries are available for large number of languages and environments (java, javascript, c, python …): http://mqtt.org/wiki/software

I have noticed that the maven artefacts for eclipse paho are not rightly pushed to the maven central repository. Might need to reference a dedicated M2M eclipse nexus repository like http://repository.m2m.io:8081/nexus/index.html#welcome. For my tests, I have used “mqtt-client” artefact from http://repo.springsource.org/libs-milestone/ repository.

Already in your every day’s life ?

IoT scenarios such as sensors/temperature updates, or any smart devices notifications can be efficiently developed with this kind of push protocol. An  ordinary M2M scenario consists in simply connect an Arduino device to a web service with MQTT. (Don’t know if Sigfox is using this protocol for their solutions)

Why another MQ protocol ? Instead of enterprise messaging brokers, MQTT is intentionally oriented for low footprint usages, making it a great solution for today’s mobile and developing “Internet of Things” applications. Companies like Facebook are already using it in their mobile applications, because of its low power and network bandwidth usage . (http://mqtt.org/2011/08/mqtt-used-by-facebook-messenger)

Here is a power profiling test : HTTPS Long Polling vs. MQTT with SSL, on Android : (http://stephendnicholas.com/archives/1217)

Cloud infrastructure is in the party too. It’s now very easy to deploy a broker in the cloud, making it quickly available for your devices fleet. Even if deploying a broker on a cloud platform like Amazon Ec2 is affordable, company  like M2M.io (http://m2m.io/) try to help bringing easily your devices online (we haven’t tested this solution yet).

A last word for another kind of industrial Mqtt usage : critical network architectures. In Toulouse, we are aware of critical network communications like onboard aircraft communication with ground servers. These kind of scenarios are not always easy. An architecture based on Mqtt could have its place in this kind of environment.

Share Button

Arnaud Giuliani Author: Arnaud Giuliani

French Java Software Tech, create and run #java #server gears (distributed and other under the hood stuffs). Also like to make #android apps

2 Comments

  1. Hi,

    Nice Article. We are testing RabbitMQ and Mosquito now.
    Which one do you suggest ? We don’t use that powerful Microcontrollers.

    Thanks,
    Vatsal

    • Arnaud Giuliani

      Hi,

      If you plan to use Spring framework stack for your development, I suggest consider using rabbitmq. Spring Integration & Messaging can greatly help you bring MqTT in your application. RabbitMQ claims to cover almost Mqtt spec. Check if there is any uncovered point, needed for your case. Even if Mosquitto is the reference given by MqTT team, I ve tried MqTT Spring Integration Tests on Mosquitto broker without having good results and performances. Mosquitto has a small footprint and is ideal to embed on limited devices.

      Regards,

      Arnaud.

Leave a Reply

Required fields are marked *.


CommentLuv badge