MQTT version 5 support in Industrial Communication Toolbox

4 次查看(过去 30 天)
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.

采纳的回答

Narvik
Narvik 2023-12-22
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!

更多回答(1 个)

Ernst van der Pols
Ernst van der Pols 2024-1-10
编辑:Ernst van der Pols 2024-1-10
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).

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by