MQTT

MQTT is a messaging prototcol for machine to machine (m2m) communication.   Client devices and applications publish and subscribe to topics handled by a broker.   A broker manages the connections between the publishers and subscribers, but more importantly is the decoupling of the publisher of the message from the subscriber.   The broker manages the messages by filtering them.   Note that MQTT is not implemented as a message queue.  

The broker can filter messages by the topic portion of each message.   Topics are strings with a hierarchical structure.   Messages may also be filtered by content and type.  

The MQTT protocol is based on a TCP/IP connection betwen one client and the broker.   To initiate a connection, the client sents a CONNECT message to the broker, and the broker responds with a CONNACK message.   The CONNECT message includes information such as ClientID, username and password for encryption.   After a connection is established, the client can publish messages to the broker.   Each message must contain a topic and the payload or data in byte format.   The client makes the decision if the data will consist of binary, text, XML, or JSON.   The topic is a simple string with a forward slash as a delimiter.   The Quality of Service Level (QoS) determines the guarantee of delivery requested by the client: at most once (0), at least once (1), exactly once (2).  

Use a JSON encoded message payload such as {"device001":12.45"} when possible so that it may be encrypted.   Only put public information in the topic.  

mqtt-topic-payload-design-notes

Tools & Sandboxes

I have had success using mqtt.eclipse.org on port 1883 from the Chrome app MQTTlens and the Python eclipse paho library.  

eclipse iot MQTT CoAP & LWM2M sandbox

HiveMQ Public MQTT Broker

MQTTLens client tool Chrome plugin

HiveMQ online broker

Online tools to simulate a MQTT client

Mosquitto free self hosted broker

mosquitto.org test server

 

MQTT-SN is for sensor networks.  

Thingstream MQTT beginner's guide

mqtt.org

Steve's internet guide - MQTT