Iot platform with Go and Mqtt


(Foad) #1

Hello all, I’ve just finished learning Go online courses and I’d like to develop an IOT platform like http://thingspeak.com based on MQTT. But I don’t know where to start? I’ve found an MQTT server written in go called VolantMQ. Do I need to download and modify the VolantMQ source code to achieve my goal? Sorry if my question is so general. I would appreciate if you guide me what approach should I take? If I need to learn more courses on Computer Science I would be grateful if you introduce me. Since I’m newbie in Computer Science I just don’t know how and where to use pre written codes from github and where to write my own codes?


(George Calianu) #2

It’s a must to be based on MQTT?


(Foad) #3

Yes because of performance and characteristics of MQTT for low bandwidth data transmission.


(Ignacio Gómez) #4

You probably don’t want to mess with the internals of an MQTT broker and most likely don’t need to either. Instead, just choose one of the free or open-source ones (I recommend mosquitto) and use some Go client (e.g., https://github.com/eclipse/paho.mqtt.golang) to publish and subscribe to topics from your application.


(Foad) #5

Using paho mqtt Go client, does it support authorizing users using a database? And to filter out messages should I subscribe to all incoming messages receiving by the broker?


(Ignacio Gómez) #6

Authentication and authorization are up to the broker. In the case of mosquitto, it supports static files auth or custom methods through auth plugins as linked shared objects. Though archived a few months ago, the most popular and used one is https://github.com/jpmens/mosquitto-auth-plug, written in C. Then there’s https://github.com/iegomez/mosquitto-go-auth, which I wrote in Go and shares a lot of functionality but differs in some backend capabilities and other details. Since you are looking to practice Go, you could write a plugin of your own to deal with your auth needs.


(Foad) #7

The plugin you wrote supports almost everything I need, do you recommend me using your plugin for my project?


(Ignacio Gómez) #8

As far as I know, it’s being used in production in a bunch of projects as it’s part of the official documentation of LoRa Server (the reason I developed it in the first place). I also try to respond to any issue as quick as possible, so in that sense yeah, go ahead, but know that the alternatives are fine too.

In any case, an auth plugin should be just a kind of helper to your application and pretty much replaceable: the important and interesting parts are those from your application’s core logic, which are the ones you’ll be building.

I think the readme documents pretty well what the plugin does, but please file an issue if you find any problem and feel free to message me if your struggling with something. Good luck!


(Foad) #9

Thank you for your time and explanations. It was quite enlightening.


(system) closed #10

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.