eclipse/paho.mqtt.m2mqtt

No graceful disconnect when messages as still in the queue

AtosNicoS opened this issue · 1 comments

I try to distinguish between 3 different kind of device status:

  • online
  • offline
  • ungraceful disconnect

Now If i try the following:

client.Connect(clientId, "", "", true, 2, true, rootTopic + "status", "disconnected", false, 60);

client.Publish(rootTopic + "status", Encoding.UTF8.GetBytes("offline"), MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE, true);
client.Disconnect();

I get the message "offline" on the subscriber, but the last will message "disconnected" as well. If I add some delay between the publish and the disconnect, no last will is sent and the client disconnects properly.

we are having the same issue, offline disconnect from graceful is being published but not ungraceful disconnect, when the device goes down, dueto network etc.