Today I would like to introduce you MQTT (MQ Telemetry Transport). I would also like to describe it’s benefits and why it is better then HTTP protocol in Internet of Things (IoT) world.
HTTP is mature and really established protocol. Is easy to use and know by almost everybody. Is perfect for request and response. But in our IoT world is not ideal. It is text based protocol which requires more bandwidth. Also requires working web server which requires small or bigger server but will not work on really small IoT devices. This could be a bit a limitation for users as web server and long text response and request will require more power which unfortunately for IoT uptime (battery )is crucial.
However MQTT is publish and subscribe (pattern) based light weight messaging protocol with quality of service. I think this already give us flexibility. In large scale systems which based on network with small end-devices being able to subscribe to one or another sensor without writing a parser sound really useful. It requires minimal bandwidth as it is binary format. It header is build from just two bytes. Which also shows that devices uses MQTT requires less battery.
In MQTT our central point is a broker which sends received messages publishes to subscribers. As simply like that:
There are number of brokers but the one most is Mosquitto (mosquitto.org). It supports most of the platform and can be installed on almost any computer.
If you would like to read more about mqtt protocol in more technical view you can read it here:
Okay done with theory. I have just installed Mosquitto on my Raspberry PI so in next post I would like to show you a bit more DIY base on ESP8266 sensors which we used previously. But if you haven’t do it then I am inviting you to read previous posts and get more familiar with ESP8266.
Have a nice day!
Github repository: https://goo.gl/ii9xsz
Be positive and stay calm!