Topic: Publishing files

Hi,

I want to transport large payloads (files) with wolfMQTT. Receiving this data via a subscription was surprisingly easy, the data comes in in chunks which I write to a file as they come in.

But is there a similar solution available for publishing large payloads? It would be nice if I could read the data piece by piece from a file as it's sent out.

Regards,
Peter

Share

Re: Publishing files

Hi Peter,

Thanks for the excellent question! We are working on an enhancement right now to add the ability to chunk large publish messages being sent. The engineer working on this is Eric B. He will be following up with you shortly.

Thanks,
David Garske, wolfSSL

Share

Re: Publishing files

Hi PeterL,

The new methods for publishing are available to review in https://github.com/wolfSSL/wolfMQTT/pull/92

This update adds two methods: A callback that is executed from the new MqttClient_Publish_ex API; and it is now possible to simply call MqttClient_Publish successively when the payload buffer size is smaller than the total payload size as set in the MqttPublish structure parameter. The example for the client firmware push was modified to use the new publish callback.

Best regards,
Eric Blankenhorn,
wolfSSL Support

Re: Publishing files

Hi Eric and David,

Thank you for this update. I tried it, and it worked. The only thing I found was that when using a QoS of 0,  MqttClient_Publish_ex will return with the length of the last chunk instead of MQTT_CODE_SUCCESS.

I also noticed that publishing data took roughly 40x more time compared to subscribing to the same data. (2.5MB, 195sec vs 4.5sec) I suspect this is because encrypting data takes more time than decrypting it?

I'm running a 32bit microcontroller (RX63N) on 96MHz, without hardware encryption.

Peter

Share

Re: Publishing files

Hi Peter,

I'm glad you had an opportunity to test the changes and thank you for your feedback. I will have a look into the return value from MqttClient_Publish_ex. I think your suspicion is correct regarding the publish throughput.

Thanks,
Eric Blankenhorn
wolfSSL Support

Re: Publishing files

Hi Peter,

I fixed the issue you reported with MqttClient_Publish_ex. You can review the update in https://github.com/wolfSSL/wolfMQTT/pull/95

Thanks,
Eric Blankenhorn
wolfSSL Support