emqx / MQTTX

A Powerful and All-in-One MQTT 5.0 client toolbox for Desktop, CLI and WebSocket.
https://mqttx.app
Apache License 2.0
3.9k stars 447 forks source link

[Bug] Auto-Reconnect does not handle configuration change #1746

Open SpeckiJ opened 2 months ago

SpeckiJ commented 2 months ago

What did I do

  1. Try to connect to a broker with default settings but invalid Path (e.g. connecting to wss://broker.emqx.io:8084/mqtt_invalid_path.

  2. Notice that the Path is wrong, open configuration and fix the path (/mqtt_invalid_path --> /mqtt).

  3. Close configuration and start a new connection with the new configuration

What happened

The client successfully connects after fixing the configuration. But I receive Alerts about Reconnecting every couple of seconds. When looking at the Network-Tab in the Browser console it shows that it still tries to reconnect with the old invalid configuration, although i have changed them already.

The only workaround i have found so far to get rid of the background-reconnects is to refresh the page (via F5 or Ctrl+R in the Desktop Client).

Expected

When changing the configuration of a client all auto-reconnection attempts for this client should be cancelled. After I have changed the configuration the old configuration should not be used anymore.

Environment

More detail

Screenshot of Proxy showing the requests that are sent out by the client. Blue marks the point in time where the configuration was fixed:

mqttx_test drawio(1)

This is probably a duplicate to https://github.com/emqx/MQTTX/issues/1680 that was unfortunately closed due to inactivity.

ysfscream commented 2 months ago

@SpeckiJ Hi, this is indeed a BUG that appeared on Desktop before and might not have been completely fixed in the Web version. Thank you for your feedback, we will fix it in the next version.