hivemq / hivemq-mqtt-client

HiveMQ MQTT Client is an MQTT 5.0 and MQTT 3.1.1 compatible and feature-rich high-performance Java client library with different API flavours and backpressure support
https://hivemq.github.io/hivemq-mqtt-client/
Apache License 2.0
824 stars 153 forks source link

When app is removed from recent apps list the username is "undefined" #587

Closed pravingaikwad07 closed 4 months ago

pravingaikwad07 commented 11 months ago

πŸ› Bug Report

Username is updated to "undefined"

πŸ”¬ How To Reproduce

Steps to reproduce the behaviour:

  1. Open app. Create connection with some username and password.
  2. Connection is established
  3. Remove app from recents and open the app again
  4. Remove app from recents stay as it is, don't open the app for some time. check server. the username is "undefined"
  5. Same applies when app is idle for long time.
  6. This is sporadic but happens most of the time.

Code sample

// doing connection like this val ack = mqttClient!!.connectWith() .keepAlive(30) .cleanSession(false) .simpleAuth() .username("abcuser") .password("pwd123") .applySimpleAuth() .send()

// builder mqttClientBuilder = Mqtt3Client.builder() .automaticReconnect() .initialDelay(1, TimeUnit.SECONDS) .maxDelay(60, TimeUnit.SECONDS) .applyAutomaticReconnect() .serverHost(MQTTIPADDRESS) .identifier(clientIdentifier) .webSocketConfig(MqttWebSocketConfig.builder().serverPath(MQTT_SERVER_PATH).build()) .sslWithDefaultConfig() .addConnectedListener(mqttAddConnectionListener) .addDisconnectedListener(mqttDisconnectConnectionListener) .serverPort(MQTT_SERVER_PORT_NUMBER)

Environment

Android device

Hardware or Device? Android

Operating System? Server on Mac / app on Android

Which MQTT protocol version is being used? 3.1.1 mqtt

Which MQTT broker (name and version)? Hive MQTT

Screenshots

Screenshot 2023-08-09 at 6 47 15 PM

πŸ“ˆ Expected behavior

The client should auto reconnect with same username.

πŸ“Ž Additional context

This happens when app is removed from the recent tasks or the app is in background for long duration.

pglombardo commented 4 months ago

Hi @pravingaikwad07 - This looks to be an EMQ broker UI issue. The HiveMQ client will reconnect using the same credentials for the initial connection unless overridden via the Reconnector.

And to add to this position, we have many devices that reconnect to the HiveMQ broker and HiveMQ cloud that don't show this issue.

I'll close this issue as invalid but if you think I'm mistaken please let me know. I'd be happy to look closer if you could provide client code to reproduce with a test in HiveMQ broker. Unfortunately we can't debug the EMQ UI.