Iot platform with Go and Mqtt

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?

It’s a must to be based on MQTT?

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

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.

1 Like

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?

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.

1 Like

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

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!

1 Like

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

1 Like

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