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
var server = "192.168.1.10";
var mqtt = require("tinyMQTT").create(server);
mqtt.on('connected', function() {
console.log("MQTT Connected\n");
mqtt.subscribe("/test");
});
mqtt.on('message', function (msg) {
console.log(JSON.stringify(msg));
});
digitalWrite(D11,1); // enable ESP8266
Serial1.setup(115200, { rx: D12, tx : D10 });
var wifi = require("ESP8266WiFi_0v25").connect(Serial1, function(err) {
if (err) throw err;
console.log("Connecting to WiFi");
wifi.connect(SSID, PASSWORD, function(err) {
if (err) throw err;
console.log("WiFi Connected");
mqtt.connect();
});
});
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
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
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
1 Attachment