Open ferdinand0815 opened 2 months ago
which library version and core version are you using?
ArduinoMqttClient version=0.1.8 ESP8266 is 3.1.2
The VS Code Arduino extension seems to use CLI 0.31
This is only an issue when connecting to a host using its IPAddress, not via host name.
This offers a quick solution, convert the IP to a string .. not ideal but whatever.
uint16_t mqttPort = 1883;
IPAddress testIP = IPAddress(91, 121, 93, 94); // test.mosquitto.org
// works
mqttClient.connect(testIP.toString().c_str(), mqttPort);
// does not compile
mqttClient.connect(testIP, mqttPort);
The library fails to compile on ESP8266 when calling connect() with a port, as in mqttClient.connect(mqttBrokerIp, mqttPort).
This has actually already been fixed quite some time ago in this pull request https://github.com/arduino-libraries/ArduinoMqttClient/pull/33 by removing the ESP8266 specific code in MqttClient.h. I briefly tested the connect() using test.mosquitto.org, no idea about flush and stop.