Protocols

MQTT

MQTT is a light-weight protocol used for Machine to Machine (M2M) communication. MQTT used a publish/subscribe message forwarding model built on top of TCP/IP protocol.

Mosquitto

Mosquitto is an open source (BSD licensed) message broker that implements the MQ Telemetry Transport protocol versions 3.1 and 3.1.1. MQTT provides a lightweight method of carrying out messaging using a publish/subscribe model.

Mosquitto Homepage

Mosquitto Intel® Edison Setup

Building and running Mosquitto MQTT on Intel Edison

Mosquitto Intel® Galileo Setup

  1. root@galileo:~# wget http://mosquitto.org/files/source/mosquitto-1.3.5.tar.gz
  2. root@galileo:~# tar xvf mosquitto-1.3.5.tar.gz
  3. root@galileo:~# cd mosquitto-1.3.5
  4. root@galileo:~# make WITH_SRV=no
  5. root@galileo:~# adduser mosquitto
  6. root@galileo:~# cd test/broker
  7. root@galileo:~# make test
  8. root@galileo:~# cd ../../
  9. root@galileo:~# cp client/mosquitto_pub /usr/bin
  10. root@galileo:~# cp client/mosquitto_sub /usr/bin
  11. root@galileo:~# cp lib/libmosquitto.so.1 /usr/lib
  12. root@galileo:~# cp src/mosquitto /usr/bin

Mosquitto Applications

  1. root@platform:~# mosquitto
  2. root@platform:~# mosquitto_sub
  3. root@platform:~# mosquitto_pub

Mosquitto Demo Temperature Gauge

Go to http://test.mosquitto.org/gauge/ and execute

  1. root@platform:~# mosquitto_pub -h test.mosquitto.org -t temp/random -m 23.0

Mosquitto MQTT Server/Broker

As subscriber

  1. root@galileo:~# mosquitto_sub -h test.mosquitto.org -p 1883 -t workshop/galileo
  2. root@edison:~# mosquitto_sub -h test.mosquitto.org -p 1883 -t workshop/edison

As publisher

  1. root@galileo:~# mosquitto_pub -h test.mosquitto.org -p 1883 -t workshop/galileo -m "Hello Galileo Operators!"
  2. root@edison:~# mosquitto_pub -h test.mosquitto.org -p 1883 -t workshop/edison -m "Hello Edison Operators!"

As subscriber

  1. root@platform:~# mosquitto_sub -h test.mosquitto.org -p 1883 -t workshop/all

As publisher

  1. root@platform:~# mosquitto_pub -h test.mosquitto.org -p 1883 -t workshop/all -m "Hello All Operators!"

See output for the following command

  1. root@platform:~# mosquitto_sub -h test.mosquitto.org -t "#" -v

Constrained Application Protocol (CoAP)

Constrained Application Protocol (CoAP) is a software protocol intended to be used in very simple electronics devices that allows them to communicate interactively over the Internet. It is particularly targeted for small low power sensors, switches, valves and similar components that need to be controlled or supervised remotely, through standard Internet networks … From Wikipedia, the free encyclopedia