Added mqDns to tinytest

This commit is contained in:
hsaturn
2021-04-10 16:50:14 +02:00
parent c75f4893e8
commit b280196395

View File

@@ -1,6 +1,7 @@
#define TINY_MQTT_DEBUG
#include <TinyMqtt.h> // https://github.com/hsaturn/TinyMqtt #include <TinyMqtt.h> // https://github.com/hsaturn/TinyMqtt
#include <MqttStreaming.h> #include <MqttStreaming.h>
#include <ESP8266mDNS.h>
#include <sstream> #include <sstream>
#include <map> #include <map>
@@ -55,6 +56,14 @@ void setup()
Serial << "Connected to " << ssid << "IP address: " << WiFi.localIP() << endl; Serial << "Connected to " << ssid << "IP address: " << WiFi.localIP() << endl;
Serial << "Type help for more..." << endl; Serial << "Type help for more..." << endl;
const char* name="tinytest";
Serial << "Starting MDNS, name= " << name;
if (!MDNS.begin(name))
Serial << " error, not available." << endl;
else
Serial << " ok." << endl;
MqttBroker* broker = new MqttBroker(1883); MqttBroker* broker = new MqttBroker(1883);
broker->begin(); broker->begin();
brokers["broker"] = broker; brokers["broker"] = broker;
@@ -344,6 +353,8 @@ void loop()
} }
static long count; static long count;
MDNS.update();
if (MqttClient::counter != count) if (MqttClient::counter != count)
{ {
Serial << "# " << MqttClient::counter << endl; Serial << "# " << MqttClient::counter << endl;