eclipse / paho.mqtt.m2mqtt

Eclipse Public License 1.0
512 stars 303 forks source link

No graceful disconnect when messages as still in the queue #84

Open AtosNicoS opened 6 years ago

AtosNicoS commented 6 years ago

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

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.

marwan87 commented 6 years ago

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.