MQTTnet icon indicating copy to clipboard operation
MQTTnet copied to clipboard

DisconnectedAsync not fired on time

Open Stannieman opened this issue 2 years ago • 0 comments

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

  1. Connect a client to a broker with options that have a KeepAlivePeriod of 2 seconds and Timeout of 1 second.
  2. Disable Wi-Fi (I connected to a broker over Wi-Fi, not sure if this matters)
  3. You can keep publishing messages and they will all fail.
  4. 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.

Stannieman avatar Aug 02 '22 15:08 Stannieman