You are reading a single comment by @Ollie and its replies. Click here to read the full conversation.
  • I'm testing against test.mosquitto.org. Every so often I get disconnected - which I imagine is from the server and is to be expected, as I think they regularly rollout the latest version.

    I have a disconnect event I can listen on, and currently I reissue mqtt.connect() in the events callback. My problem with this approach is that I'm losing memory. It might survive one reconnect, but not two. I have duplicated message listeners which I imagine is part of the memory problem.

    I considered another approach would be to save to memory and fire the reset() function, to bring the board and whole program back up?

    But is there any pattern/approach that I could use to recover without a restart?

    Edit: I've just considered that maybe I should unbind the listeners in the disconnect event callback too?

About

Avatar for Ollie @Ollie started