I had the same issue, it seems that the default MQTT module sometimes gets a ping reply and the message in a single packet and is not separating the two. Did you try the updated library I posted on Github?
For the record, I was running into the same issue of split data packets.
I tried your updated script and my experiment now works as expected!
Thanks so much :) (h)
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 had the same issue, it seems that the default MQTT module sometimes gets a ping reply and the message in a single packet and is not separating the two. Did you try the updated library I posted on Github?