hivemq-mqtt-client icon indicating copy to clipboard operation
hivemq-mqtt-client copied to clipboard

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

Open pravingaikwad07 opened this issue 2 years ago • 0 comments

🐛 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.

pravingaikwad07 avatar Aug 09 '23 13:08 pravingaikwad07