Hi, I am working on a project with MQTT and using a WiFi shield to connect Arduino to the broker.
I have been successful in using Knolleary's pubsubclient Arduino Client for MQTT · knolleary having applied the fix that is suggested here Arduino Mqtt Client – DutchTechy.
I am now trying to set a last will message when connecting to the broker, but the connection fails.
Since Knolleary supports last will and nobody raised issues about this before, I believe the root cause is the same that requires the above mentioned fix and that is decribed here mqtt - Mosquitto socket read error Arduino client - Stack Overflow, namely an alledged error in the WiFi library.
Since I don't have the technical knowledge to modify the WiFi library itself or to find another workaround, I'm asking the community if someone else has come across this issue and solved it.
It all boils down to a single line of code:
client.connect(mqttClientId, (char*)mqttUser, (char*)mqttPass, lastWillTopic, 0, true, "Client lost connection");
Many thanks in advance!