[examples] Little modification for RETAIN

This commit is contained in:
hsaturn
2023-03-22 20:28:58 +01:00
parent 294657f2ca
commit 245e74666e
2 changed files with 7 additions and 3 deletions

View File

@@ -1,7 +1,9 @@
#include "TinyMqtt.h" // https://github.com/hsaturn/TinyMqtt #include "TinyMqtt.h" // https://github.com/hsaturn/TinyMqtt
#define PORT 1883 const uint16_t PORT 1883;
MqttBroker broker(PORT); const uint8_t RETAIN = 10; // Max retained messages
MqttBroker broker(PORT, RETAIN);
/** Basic Mqtt Broker /** Basic Mqtt Broker
* *
@@ -16,6 +18,8 @@ MqttBroker broker(PORT);
* Your ESP will become a MqttBroker. * Your ESP will become a MqttBroker.
* You can test it with any client such as mqtt-spy for example * You can test it with any client such as mqtt-spy for example
* *
* Messages are retained *only* if retain > 0
*
*/ */
const char* ssid = ""; const char* ssid = "";

View File

@@ -1,7 +1,7 @@
#include "TinyMqtt.h" // https://github.com/hsaturn/TinyMqtt #include "TinyMqtt.h" // https://github.com/hsaturn/TinyMqtt
#include "TinyStreaming.h" // https://github.com/hsaturn/TinyConsole #include "TinyStreaming.h" // https://github.com/hsaturn/TinyConsole
/** Simple Client (The simplest configuration) /** Simple Client (The simplest configuration, client only sends topics)
* *
* *
* +--------+ * +--------+