From 245e74666e1b33bb6b3b2044d205167bf56eec25 Mon Sep 17 00:00:00 2001 From: hsaturn Date: Wed, 22 Mar 2023 20:28:58 +0100 Subject: [PATCH] [examples] Little modification for RETAIN --- examples/simple-broker/simple-broker.ino | 8 ++++++-- examples/simple-client/simple-client.ino | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/simple-broker/simple-broker.ino b/examples/simple-broker/simple-broker.ino index 1b054bd..3abf151 100644 --- a/examples/simple-broker/simple-broker.ino +++ b/examples/simple-broker/simple-broker.ino @@ -1,7 +1,9 @@ #include "TinyMqtt.h" // https://github.com/hsaturn/TinyMqtt -#define PORT 1883 -MqttBroker broker(PORT); +const uint16_t PORT 1883; +const uint8_t RETAIN = 10; // Max retained messages + +MqttBroker broker(PORT, RETAIN); /** Basic Mqtt Broker * @@ -16,6 +18,8 @@ MqttBroker broker(PORT); * Your ESP will become a MqttBroker. * You can test it with any client such as mqtt-spy for example * + * Messages are retained *only* if retain > 0 + * */ const char* ssid = ""; diff --git a/examples/simple-client/simple-client.ino b/examples/simple-client/simple-client.ino index 0ba8179..fada697 100644 --- a/examples/simple-client/simple-client.ino +++ b/examples/simple-client/simple-client.ino @@ -1,7 +1,7 @@ #include "TinyMqtt.h" // https://github.com/hsaturn/TinyMqtt #include "TinyStreaming.h" // https://github.com/hsaturn/TinyConsole -/** Simple Client (The simplest configuration) +/** Simple Client (The simplest configuration, client only sends topics) * * * +--------+