paho.mqtt.javascript
paho.mqtt.javascript copied to clipboard
Reconnect on mobile devices
I am using paho-mqtt with react-native on mobile devices. After the application enters the background state, the connection is broken. When the application resumes, the reconnect timeout is at a minimum value 1 seconds. But, missed messages begin to arrive after 60 second as keepAliveInterval default value.
Desired behavior. After determining that the application has left the background or sleep state, immediately connect to the server and receive all pending messages.
@apapacy Where did you land on this? I am not using react native, but I am using react and am having a similar issue where if the screen is locked from a mobile device, the client's connection is severed and takes a up to a full minute to reconnect. If this is actually tied to the keepAliveInterval, would setting that lower actually help with reconnect time?
Also, digressing a bit, I have noticed that the Python version has a method for customizing the reconnect delay yet I cannot seem to find anything similar in the docs for Javascript. It would be nice to have this feature for JS users as well.
it depends on the value of the parameter keepAliveInterval and in my opinion controlled by server.
Excuse me @apapacy! How can u use paho-mqtt in react-native
Excuse me @apapacy! How can u use paho-mqtt in react-native
I used this Tutorial
However I'm getting a problem when I'm releasing my apk (https://stackoverflow.com/questions/60895132/app-works-in-android-and-ios-simulator-but-not-after-release)