Let me introduce luamqtt - https://github.com/xHasKx/luamqtt - the MQTT client library for Lua programming language.
It's not based on any C module and written in pure Lua code from scratch and completely follows OASIS standards for the MQTT v5.0 and the MQTT v3.1.1 protocols.
The only main dependency is a luasocket module to open a TCP connection. But there is a mechanism to implement your own functions to open a TCP connection and send/receive from it. It's used, for example, in the OpenResty to use its ngx.socket.tcp module instead of luasocket.
This is a thread for discussion, feedback and feature requests of the luamqtt.
Alternatively, the GitHub issues are welcomed.
Awesome work, I just found it and looking to give it a try on LogicMachine which don't have mosquitto package available.
Thanks! And don't hesitate to post here your LogicMachine integration experience!
Thanks, the main challenge with LM is that it does not support libraries, a library should be wrapped as a user script, which is basically a single file. I'm still trying to get my head around on how to "compile" this as i'm not Lua expert, yet.
So you have to emulate module loading by require() function: https://www.lua.org/manual/5.3/manual.html#pdf-require
You may try to wrap each module file into a function, returning the module table. And write your own require() function calling that module-emulating functions.
Do you succeed with opening TCP connection to internet from the LM device?
Hi, it does have require(), however full module should be within a single file. Haven't had time to play around with that yet. I'm also waiting for forum account confirmation so I can get example of the other library wrapped from multiple source files.
I will be making connections to local MQTT broker, but internet is also possible if network allows that.