Hacking with mosquitto

- 2 mins

What I have been upto these days?

It has been almost a month when we (I and Ravi Lakhotia) started hacking on mosquitto source code. Mosquitto is a open source broker for MQTT. MQTT is a protocol for IoT devices (and can be extended to others as well) based on publish-subscribe model for exchanging messages/data between them.

What has been achieved?

Well, there are couple of things we are working on :-

i) Firstly, now we have a good understanding of the source code and its has been a quite learning experience for me. Especially the part where the subscribers fluctuate in numbers and accordingly the memory is allocated and re-allocated/freed on sockets simultaneously. Well, this may sound like simple stuff but the code is indeed beautiful and intriguing around it.

ii) We have been able to map the flow of messages across the broker i.e. originating from publisher and receiving to the client. There are also couple of hook points we have exposed where we are planning to plug in some code in form of “plugins”.

iii) If you look at the logs generated by mosquitto, your eyes may bleed. Well, I didn’t have much problem with the logs as I am accoustomed to see vague things and make sense out it ! But Ravi, asked me to do it anyway and make logs more readable, user-friendly (I hope so =P) and I didn’t have much problem implementing it. We have pretty good logs now. Yay!

iv) The forked branch has already been setup on a server and testing has been started. I hope the branch will be more custom and stable in the coming month.

Issues on hand

But still there are many issues we have on hand. First of all, there is already implementation of auth plugin for the broker and I have not yet laid on hands on it. This is top 5 in my list for this month already. Couple of things are going on (mainly GSoC and exams at same time :’( ) for me. I admit I am not good at managing time!

Well after we explore the auth plugins, we have planned for making a SDK for writing more and more plugins for developers. Ravi is hell bent on doing so (I think so..) :P

One main problem where I am stuck is: The message is divided into network packets and sent out from the broker. Well, I do understand networks and packets in general but the code bewilders me! I have been not able to get past that. The formation of packets is something I am missing on the front. The concept in general looks simple but the implementation of code is not quite obvious. I don’t know how much more time it will take to get past that.

Well, let’s see how it works out. I’ll update a more structured post regarding MQTT and Mosquitto for that matter. You can consider this one as a rambling !! :D

A short clip about MQTT broker working I made a while ago:

P.S. - uajain has exam tomorrow and this post is produced out of boredom !

Umang Jain

Umang Jain

Makes the machines talk

comments powered by Disqus
rss facebook twitter github youtube mail spotify instagram linkedin google pinterest medium