MikeV wrote:I've eventually got MQTT to work on this build, but it's taken a long time! To figure out why it wasn't working I created a state machine so I could monitor each step. The main issue seemed to be the m:publish function which can't be recalled until it's completed its work. I've now trimmed it back and the code to the minimum that works for me. It seems to survive temporarily stopping the broker and the wifi node. "init.lua" contains just dofile("MQTT.lc") after compiling with node.compile("MQTT.lua"). Remaining HEAP is 11912 - so not much left to play with!
Try to make some variables local it will speed things up as I learned.