MQTT Client and longer messages #6635
Replies: 1 comment
-
Posted at 2022-05-06 by @MaBecker Well, tinyMQTT can not handle messages larger than 127 bytes. https://github.com/MaBecker/tinyMQTT Posted at 2022-05-06 by sammachin Doh! just noticed I'm using tinyMQTT rather than the regular client that I was looking at the docs for, that will teach me to copy code from another project Posted at 2022-05-10 by @gfwilliams :) does it work better using the normal MQTT library? Posted at 2022-05-10 by sammachin kind of! Trying with espruinio on an ESP32 seems to work much better although I'm now into issues with the waveform class and that. Posted at 2022-05-10 by @gfwilliams Argh, that's a pain. On the Espruino Wifi we enabled flow control (https://github.com/espruino/EspruinoDocs/blob/master/devices/EspruinoWiFi.js#L252-L288)... You could set up CTS:
Hmm, yes, I'm not sure how well that works on ESP32... Posted at 2022-05-10 by @MaBecker Waveform, just checked the list (espruino/Espruino#1777) of open ESP32 issues. If it's broken please share some info to be added to the list of issues. Posted at 2022-05-12 by sammachin @MaBecker I've just tested with the sample output code on https://www.espruino.com/Waveform and that plays back fine on an ESP32 so looks like thats ok its just my encoding that I need to look at @gfwilliams is there any more detail on the audio encoding for waveform, at the moment I have PCM frames with 16bit 8KHz samples, little endian Posted at 2022-05-16 by @gfwilliams I can't remember about the exact 16 bit encoding, but I'd strongly recommend just using 8 bits - it's not like you'll get anything over 8 bits worth of quality using PWM as a DAC :) For 8 bits I seem to recall I had to export from Audacity as 'unsigned' or something like that. Basically you want a value from 0..255, not -128..127. You could always just add 128 to the numbers in Espruino when you load the buffer, but if you can it's worth getting the data right at the start. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2022-05-06 by sammachin
I've been doing some experiments with MQTT but I'm having an issue receiving messages with a longer payload, ideally 320bytes of binary or 468bytes base64 encoded.
I wrote a tests and it seems like the mqtt client does unpredictable things over ~100 chars in the payload.
This is the test client on a pixl running 2v13, with an ESP8266 connected for WiFi
My test source publishing a message once a second where the first characters are a number then its padded with that number of dots eg
5....
Result is in the attached file, as you can see it starts to loose parts of the payload around 100chars and at 120chars the topic becomes corrupted.
These points seemed to vary a little with different runs, and the length of the topic so I suspect its something in the overall size of the message thats the limiting factor.
According to the MQTT spec it should support messages up to 256mb! while I realise thats totally crazy for Espruino it would be nice if it was able to handle a biut more. even 1kb would be enough for my needs
Attachments:
Beta Was this translation helpful? Give feedback.
All reactions