hivemq-mqtt-client
hivemq-mqtt-client copied to clipboard
When app is removed from recent apps list the username is "undefined"
🐛 Bug Report
Username is updated to "undefined"
🔬 How To Reproduce
Steps to reproduce the behaviour:
- Open app. Create connection with some username and password.
- Connection is established
- Remove app from recents and open the app again
- Remove app from recents stay as it is, don't open the app for some time. check server. the username is "undefined"
- Same applies when app is idle for long time.
- 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
📈 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.