@matt You should consider checking the connection state. ( Various brokers may time the connection out at the other end.) and then possibly explicitly closing the connection and re-connecting. I am using the core of the AWS MQTT package to talk to Losant and had to deal with the connection status and reconnections. That package maintains the connection in a seperate thread and the library doesn't clean up well so it needed some hacking. I have found the robust and simple implementations also needs some tweaking to be reliable on ESP8266 so it doesn't surprise me. You may even find it makes sense to disconnect after sending a message and then reconnecting later. Have a look at what the default timouts and the inactivity timeouts are set for the MQTT service you are talking to,