MQTTnet
MQTTnet copied to clipboard
DisconnectedAsync not fired on time
Describe the bug
DisconnectedAsync is not fired when disconnected from the network after KeepAlivePeriod + TimeOut elapsed. It is only fired after 20 seconds and there seems to be no way to detect disconnects quicker than this. The broker does see that the client disconnects so it is definitely disconnected.
Possibly related: #1411
Which component is your bug related to?
- Client
To Reproduce
- Connect a client to a broker with options that have a KeepAlivePeriod of 2 seconds and Timeout of 1 second.
- Disable Wi-Fi (I connected to a broker over Wi-Fi, not sure if this matters)
- You can keep publishing messages and they will all fail.
- DisconnectedAsync is only fired after 20 seconds.
Expected behavior
When the first ping request or regular publish after the network disconnect fails then DisconnectedAsync is fired immediately.