Open brianmay opened 5 years ago
I've seen this recently myself, it will say could not connect and post the next retry time, which was oddly a few seconds before when i went to look at the connection. If i disable and re-enable it then it connects perfectly fine. I have in tasker a step to open the connection before publishing a message so im not sure what the purpose of that is for if the app itself needs to make the connection outside of tasker, and on top of that why does it work when i simply disable and re-enable it when its been trying to reconnect for hours.
I started poking at this a little, I'm not the best at java code but looks like paho might have some updates, or the code on the github here is old. there were some updates to paho in february but the last update in the play store was from january. I compiled from where the branch for multiple brokers was merged in and its showing me v4.2.1b after i installed the app, wheras the app on the play store shows 4.5.1, i might be doing something wrong though. I tried to add the implementation lines for paho to the project on my local code that i pulled down but getting a little stuck with that and what looks like some build conflicts after I added paho dependencies which look to be newer than what is in the code here.
Hey, I have customized paho code so as to achieve some functionalities that were not available in paho. Let me look into what can be done to show a reason for connection failure.
Anything new on this? I haven't had a chance to rip out the other stuff and add an updated paho to see if it helps, anyone else?
disgustipated notifications@github.com writes:
Anything new on this? I haven't had a chance to rip out the other stuff and add an updated paho to see if it helps, anyone else?
No, sorry, I haven't had a chance to look at this again.
Possibly the issue I was having was because I mistyped in my mqtt credentials. However the error presented to the user doesn't give any level of information as to what stage it reached before it failed. -- Brian May brian@linuxpenguins.xyz https://linuxpenguins.xyz/brian/
@brianmay @disgustipated You may use the logcat to view the reason for connection failure. There are many applications available on the Play Store that let you do just that. Let me know if you think this would be okay or do you still need me to show the user a reason for failed connection.
I think my issue for the need to see why the disconnect happened was more it simply wont reconnect. It says that its going to try again but the next time its going to try is in the past. I'll log another one for that issue, perhaps the paho update would fix that...
@disgustipated If we don't have anything in the logs for why the reconnect fails, I don't think Paho or the Application code is to be blamed. I believe it's Android/Phone manufacturer's strict battery saving policy.
These days, most apps use FCM to notify that a new event has occured. But, this is not possible in our case because we don't have a server that could integrate FCM for us.
Ideally it would display the reason. However, I understand this requires somebody to actually implement that, which might be the difficulty :-)
I would suggest instead that the documentation refer to logcat as a way to debug failures. Then would be happy to close this ticket.
If the connection fails for any reason, there is no details given what went wrong. This makes it particularly difficult to troubleshoot SSL connections, which could be failing for any number of reasons. Looking at the server logs, all it says is that the connection has been disconnected, and other clients can connect fine.