-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MQTT reconnection when not disconnected. ESP8266 #300
Comments
I have the same problem.
I also tried the set keepalive up and also moved my mosquitto server from my pi to my nas, but it does not change anything. |
Make sure the client IDs are not the same, please. When using "Arduino," it's better to use a client ID that no one else is likely to use. If there is a duplicate client ID, it will immediately disconnect from the broker, and because it disconnects, the ESP32 will attempt to reconnect. This will continue endlessly. Additionally, if it is used for subscribing, just subscribe to one topic using a wildcard, for example, ex/#. This way, all topics starting with ex will automatically be subscribed. |
In my case the problem was caused by QOS1. |
@gleanlux I am observing the same. Is it documented that QOS1 is not supported? |
Actually on closer inspection it seems like making it QOS0 just increases the likelihood that the publish will succeed. If it fails the connection is closed and that is the root cause. It would be good to understand why this line is here. |
Hello!
I have a problem that I have been trying to solve for a long time.
An ESP feather board (ESP8266) reconnects to MQTT at completely random intervals.
Looking at the mosquito log, there is no disconnect, only reconnect, so when reconnecting there is an immediate disconnect/connect from the server.
In the code, as recommended, there is a 10ms delay in the loop after the MQTT loop, no delay in the rest of the program.
I have placed several debug elements in the code to detect the error.
According to the latest debug, I retrieved the lastError() parameter on MQTT disconnection, which returns the following error each time and until reconnection:
"LWMQTT_MISSING_OR_WRONG_PACKET = -9"
Configuration:
setKeepAlive(15);
or the timeout was increased last time:
setTimeout(2000);
Is there anything I haven't tried yet that might help solve the error?
Thank you very much!
The text was updated successfully, but these errors were encountered: