Disconnected event not raised after stopping and restarting ManagedClient
See original GitHub issueHi, I am currently trying to implement my own protocol fallback strategy where the websocket connection is used if the connection fails over mqtt. To do so, I start the client with the first protocol and if the ConnectionFailed event is raised, I stop the client and restart with new options. (In between the stop and start, I have had to put a delay because once StopAsync is called, the client is not yet stopped and it can’t be started again.)
However, once the client has been stopped and restarted, a loss of connection will not raise the disconnected event. The logs show the Ping TX >>> then Stopped receiving packets and that is all. I have tried the same thing on the first protocol (so no stopping of the client) and the event is raised. I have also tried raising the delay after calling StopAsync up to 5 seconds and the same happens.
This bug is happening on both MQTT and WSS connections and I have tried with v1.8.4 and v1.8.5
Steps to reproduce:
StartAsyncwith MQTT options- On connection fail,
StopAsyncand wait ~50ms StartAsyncwith WSS options- Unplug Internet cable and wait for next ping request
- The disconnected event is not fired
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:11 (4 by maintainers)

Top Related StackOverflow Question
I assume this is no longer relevant since there is no reply.
Does this apply to the latest version, too?