diff --git a/src/TinyMqtt.cpp b/src/TinyMqtt.cpp index 83f112f..a356c04 100644 --- a/src/TinyMqtt.cpp +++ b/src/TinyMqtt.cpp @@ -785,7 +785,7 @@ MqttError MqttClient::publish(const Topic& topic, const char* payload, size_t pa { return local_broker->publish(this, topic, msg); } - else if (tcp_client) + else if (tcp_client and connected()) return msg.sendTo(this); else return MqttNowhereToSend;