quick one is a MQTT client class/library available?

THX :slight_smile:

What is MQTT? Post a link to something…

just type 4 letters in google gives :

Yes, I could have searched for it, but I could have found something unrelated… Generally when asking for help, posting helpful links is helpful :slight_smile:

MQTT is fun :slight_smile:
I once created a wifi thermometer using an esp8266 that reported the temperature to an mqtt broker :slight_smile:

do we have Library available for XOJO or not ?


Hi Guido. I too had been looking for a MQTT library for Xojo but had no luck in finding anything even related to MQTT. I didn’t have the skill to create a MQTT library for Xojo so I just gave up on Xojo and used another language & IDE (Xamarin Studio).

I would have preferred to continue using Xojo but I find it so far behind with libraries etc. MQTT is the leading protocol for IOT communications so I found it hard to believe Xojo didn’t have a library for this. The protocol has been around since 2000 there abouts.

Let me know if you have any luck finding anything :slight_smile:

Such things should be in github where a community helps eachother developing. I have a few repro’s but no luck finding assistance in development from the xojo community. It would be awsome to have such funtionality though.

I’m also interested in an MQTT client library for Xojo. I haven’t found Xojo specific anything yet, but there are various open source projects that could be ported.

The MQTT Protocol is based on TCP (port 1833) which can be subclassed in Xojo to create a MQTT 3.1.1 structured (fixed) implementation.

Link to the MQTT 3.1.1 Protocol which explains each control packet type and data payload in great detail:

I would say that with the IoT dev talent on this thread it wouldn’t be too bad to create this for Xojo.

Here is a wireshark packet capture of an MQTT Client - Server transaction which will also help:

I’m currently working on an MQTT open source library for Xojo. So far I have most of the structure, I can establish the connection to a MQTT broker, ping it and subscribe to topic(s). Next step is handling a publish message and also publish. I plan to publish the first version mid July but it should only handle QoS 0 (i.e. at most once delivery) and run in the main thread.
I have in mind a threaded version and the handling of the others QoS, but as I don’t need them for my project they will come later.

As an addition to Mike’s links, there is a very useful series of blog post here:

write a dll ,and use in xojo.

this really should be easily doable
I wrote a STOMP client for Apache’s ActiveMQ years ago based on nothing more than a TCPSocket

I’ve just started developing an MQTT module in XOJO for use in my own projects. It is doable and I’m already doing a connect- and acknowledge- control packet successfully. It will be a bit of work to fully create a library to make it portable. Mosquitto, Wireshark, and MQTT.fx is my friend ;-). My first thought was to shell mosquitto_pub and mosquitto_sub (bundled with Mosquitto). It worked initially but for some reason, the command line interface crashes every time. So I decided to create my own solution.

It is still early days but I’m confident XOJO can do this with ease. Like Norman, I’m only using the TCPSocket.

There are many was you can still keep using XOJO without having to code any libraries in XOJO. One such solution would be to use PHP running a script from the command line. That way PHP will continue to run without timing out. I’m currently doing this to log published topics to a database. I’m sure I can install a service with the PHP solution or even shell the PHP Cli script from within XOJO and then just read and write the data with ease without having to code any protocols in XOJO. My PHP Cli script is very stable and has a very small footprint on the CPU and Memory of my server.

Don’t give up guys there are many ways to get things done.

and another one: on Git

Thanks Guido.

I’ve updated it today with version 1.0 alpha 5 (available here). It’s not completely functional but most of the hard work is done.
It’s a module called MQTTLib that contains all the classes. The most important one is ClientConnection where all the client stuff occurs. For now it can CONNECT, keeps the connection alive with PING and PUBLISH messages in all the 3 qualities of service (QoS).
The demo app is really basic. And the whole project totally lacks documentation.
The next step is to implement SUBSCRIBE/UNSUBSCRIBE to topics and then the handling of the broker’s messages.
At the same time hopefully, I’ll start writing documentation. I plan to do it in English, so it may take some time as it’s not my primary language.

I’m completely open to comments, ideas or critics. So feel free to send them to mqttlib{.at.}zaatardigital{.dot.}com.
If you find a bug, feel free to use GitHub’s issue manager.

hello, someone of you have make further step writing a mqtt library for xojo? I’m just enter in the magic world of iot, and it would be very nice if i can make some xojo middleware.

thanks all

[quote=434586:@Massimo Maioli]hello, someone of you have make further step writing a mqtt library for xojo? I’m just enter in the magic world of iot, and it would be very nice if i can make some xojo middleware.

thanks all[/quote]
Did you try this from the above post?

@Mike Cotrone hello, thanks for your answer, i tryed the demo you’ve linked, it works well, the only problem is that after some minutes my app was disconnected from server due to timeout. How can i keep my connection alive?

Hello Mike and Massimo,

I’m pleased to see that more than a year and a half after the last update to MQTTLib someone is recommending my work. Unfortunately, I’ve been away from Xojo for quite a while now and from development in general for a few months. I’ve recently been hired as the technical manager for an audio post-production facility so I’m afraid that, unless somebody is willing to fork the project, this one won’t evolve anymore.
As a matter of fact Za’atar Digital is due to be shutdown in the next few months.