@@ -259,6 +259,28 @@ int MqttClient::endMessage()
259259 return 1 ;
260260}
261261
262+ int MqttClient::publish (const char * topic, const char * payload, bool retain, uint8_t qos, bool dup) {
263+ int ret = beginMessage (topic, strlen_P (payload), retain, qos, dup);
264+ if (!ret) {
265+ return ret;
266+ }
267+ print (payload);
268+ ret = endMessage ();
269+ return ret;
270+ }
271+
272+ int MqttClient::publish (const String& topic, const char * payload, bool retain, uint8_t qos, bool dup) {
273+ publish (topic.c_str (), payload, retain, qos, dup);
274+ }
275+
276+ int MqttClient::publish (const const char * topic, String& payload, bool retain, uint8_t qos, bool dup) {
277+ publish (topic, payload.c_str (), retain, qos, dup);
278+ }
279+
280+ int MqttClient::publish (const String& topic, String& payload, bool retain, uint8_t qos, bool dup){
281+ publish (topic.c_str (), payload.c_str (), retain, qos, dup);
282+ }
283+
262284int MqttClient::beginWill (const char * topic, unsigned short size, bool retain, uint8_t qos)
263285{
264286 int topicLength = strlen (topic);
0 commit comments