-
Notifications
You must be signed in to change notification settings - Fork 83
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
Client stops sending mqtt data after some hours #14
Comments
Same problem. |
Same problem. Broker is mosquitto, it says after about 23 hour:
If i restart arduino, i can see the ping requests in mosquitto log, but if i restart mosquitto while arduino is connected, arduino doesn't reconnect. |
@attilagyurman in the meantime see this example, you should be able to operate for longer. |
@attilagyurman have you tried the code? Does it patch the problem? |
@5N44P Yes, it's working perfectly. |
@5N44P just to clarify this topic, was it related to the WiFi or the socket disconnecting? |
I set up this code to try and see if it is a wifi disconnection or just the connection with the MQTT broker.
|
Ok, so if it's a socket or WiFi level issue I think this can be closed or moved to the You have a pull request #15 open to track adding reconnection to the examples, which is good. |
I have the same problem on an MKR1000. Usually, it only works for like 20-30 minutes, sometimes a few hours. The wifi is connected, i'm still able to ping my arduino, the loop() code is still running, my MQTT broker is running as well. However, my device does not send data to the MQTT topic... Trying the reconnecting solution from @5N44P I will report back if it is working. Thank you! |
Having the same issue. Initially it was happening every hour, after making poll() calls less frequent it now happens every 8-10 hours. Does anyone have a permanent solution for this? |
...instead of using poll(), which seems to be VERY blocking on my end, I tend to send a random message on a random "keepalive" topic every 30s or so, seems to work by me. I have quite critical applications where the arduino is really not easily reachable (avalanche level displays on ski slopes) and this is the only thing that seemed to work okay. |
I have had my reconnecting example going for more than a year and it's working fine too |
As far as I can see, the algoritm disconnect the MQTT connection after 60 minutes, this is hardcoded in the library file. I have solved the issue, by adding this statement at the end of the loop():
|
Hi,
I'm using this library on a mkr 1010 to send some data every 5 seconds. I based my sketch on the WiFi Simple Sender example. After 1-2 hours the library stops sending mqtt messages to my broker.
For now i did the following observations:
The code is hosted on arduino create
The text was updated successfully, but these errors were encountered: