hivemq/hivemq-mqtt-client

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

pravingaikwad07 opened this issue ยท 1 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.

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.