Clear Filters
Clear Filters

MQTT version 5 support in Industrial Communication Toolbox

4 views (last 30 days)
There is no reference in the (online) documentation of the Industrial Communication Toolbox on the protocol version(s) supported by the mqttclient().
I assume, reading the API, that MQTT version 5 is not supported. Can anyone confirm that?
Thanks in advance.

Accepted Answer

Narvik
Narvik on 22 Dec 2023
Hi,
As you mentioned, there is no reference on the protocol version(s) supported by the mqttclient(). I was able to find the following documentation where MQTT v3.1.1 specifications were referenced:
As per my understanding, MQTT version 5 is not supported yet.
Hope this helps!

More Answers (1)

Ernst van der Pols
Ernst van der Pols on 10 Jan 2024
Edited: Ernst van der Pols on 10 Jan 2024
To follow up on my own question: it appeared that a colleague of mine has the Industrial Communication Toolbox installed, so I was able to assess the included mqttclient().
For those looking for an alternative solution with MQTT version 5 support, these are the steps I took to get there:
  • Download the MATLAB interface to MQTT from Gennaro Notomista. This example is similar to MQTT-in-MATLAB, but with readable 'm'-files. It includes org.eclipse.paho.client.mqttv3-1.2.2.
  • Download the org.eclipse.paho.mqttv5.client-1.2.5 (or newer) Java component.
  • Adapt and extend the Java and MATLAB wrappers to use the Paho MQTT v5 client. Its API deviates a little from the v3 release, reflecting the changes in the protocol, e.g. CleanSession is replaced by CleanStart.
  • I also adjusted Gennao's MATLAB code to mimic the icomm.mqtt.Client() API with operations like read() and write().
  • Tweaking the Java-MATLAB language bridge took most of the time, so some experience there will help.
  • Bonus: you have control over the way recieved messages are stored, so any issues there you can resolve yourself (some of you will consider this a malus).

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!