thecowan / wallpanel-android

WallPanel is an Android application for Web Based Dashboards and Home Automation Platforms
https://wallpanel.app
Apache License 2.0
747 stars 103 forks source link

MQTT reconnect error #54

Closed brahmafear closed 5 years ago

brahmafear commented 5 years ago

Describe the bug A clear and concise description of what the bug is. MQTT attempting to reconnect before previous session has timed out (hypothesis) and mqtt server rejects connection due to reused clientID.

To Reproduce Steps to reproduce the behavior:

  1. Launch app
  2. Allow app to connect via MQTT and load web page
  3. Click back to access settings page.
  4. Click Dashboard to return to web page.
  5. "Error connecting to MQTT..."

Workaround Change clientID when settings page opened. Or wait a while before reopening dashboard.

Expected behavior MQTT connection either maintained while settings screen open or cleanly disconnected then reconnected.

Smartphone (please complete the following information):

brahmafear commented 5 years ago

About screen says 0.8.5 build 2.

Thanks.

On Mon, Jan 28, 2019 at 11:04 AM Michael Ritchie notifications@github.com wrote:

Please provide the application version you are using.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/thanksmister/wallpanel-android/issues/54#issuecomment-458191180, or mute the thread https://github.com/notifications/unsubscribe-auth/AFh0TMSdHLPxEQZg73Q3Z6fTRQMbKaoSks5vHx-YgaJpZM4aWIT5 .

thanksmister commented 5 years ago

You are a few builds behind, please update and retest.

thanksmister commented 5 years ago

The original issue no longer occurs, so I am closing this issue as the original reporter no longer responds to this issue and has reported no further issues. The steps outlined in the ticket do not occur with what you are reporting @akasma74, please provide a new issue to track with specifics about your issue.

allofmex commented 5 years ago

@thanksmister I assume this error is because of https://github.com/eclipse/paho.mqtt.java/issues/634 Had the same problem too. It seems to be fixed in paho.mqtt in meantime. Guess it requires a library update for wallpanel..

Another solution may be to change https://github.com/thanksmister/wallpanel-android/blob/cbde6445e6e0751bdd42e1641cafd3f87156bf45/WallPanelApp/src/main/java/com/thanksmister/iot/wallpanel/network/MQTTService.kt#L167

to mqttClient = MqttAndroidClient(context, mqttOptions?.brokerUrl, mqttOptions!!.getClientId(), MemoryPersistence())

Works for my devices, but I don't really know if current FilePersistence is needed for some wallpanel functions.

thanksmister commented 5 years ago

If we update the Paho library, it will no longer work on older devices due to compatibility issues with a dependency used in the Paho library. I think it has a minimum requirement of Android SDK version 6.

thanksmister commented 5 years ago

Well, so far you are the experiencing an issue that I can not reproduce, I am also running on multiple devices, including a Fire OS. I have no crash reports either in Firebase for this issue or the line of code you point out. I will review it, but do please file a new bug report to capture the information here.

thanksmister commented 5 years ago

Moved to bug report #74