You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Im currently testing with this example
I have extended the Optionsbuilder for credentials and last will. The credentials are working fine, but LW seems to not work.
string topicLW = "test/LW";
string messageLW = "Cya, im gone";
...
var options = new MqttClientOptionsBuilder()
.WithClientId(clientId)
.WithTcpServer(broker, port)
.WithCredentials(username, password)
.WithCleanSession()
.WithKeepAlivePeriod(TimeSpan.FromSeconds(30))
//.WithWillDelayInterval(10) -> Im Using 3.1 - not implemented
.WithWillQualityOfServiceLevel(MqttQualityOfServiceLevel.AtLeastOnce)
.WithWillRetain(true)
.WithWillTopic(topicLW)
.WithWillPayload(messageLW)
.Build();
Am i missing a OptionsBuilder parameter or is something off in general?
The program sends 0-9 with these OptionsBuilder settings, but my "test/LW" topic does not get changed.
Im also Testing with Retained and clearing - noted here, to explain the 3rd screenshots with "missing" topic ;)
Initial Subscription
in the middle of my test-run:
10 min. after the test:
if i test it with another subscriber i get the same result:
In the sample the client gets disconnected properly by calling DisconnectAsync. This will indicate a clean disconnect. The last will ist only published if the client is disconnected in a non clean way.
This means losing network connection or a crashing application. You can also try to make in non clean by avoiding the call of DisconnectAsync and instead calling Dispose. Or you simply close your application 😄
I did test that behaviour and came to the same conclusion this weekend.
Working for years with MQTT applications that run 24/7 i never noticed that the LW is only triggered on an ungracefull disconnect, because i do only get those. :)
Describe your question
Im Currently testing LW and cant get it working.
Which project is your question related to?
Im currently testing with this example
I have extended the Optionsbuilder for credentials and last will. The credentials are working fine, but LW seems to not work.
Am i missing a OptionsBuilder parameter or is something off in general?
The program sends 0-9 with these OptionsBuilder settings, but my "test/LW" topic does not get changed.
Im also Testing with Retained and clearing - noted here, to explain the 3rd screenshots with "missing" topic ;)
Initial Subscription
in the middle of my test-run:
10 min. after the test:
if i test it with another subscriber i get the same result:
run 1
run 2 to verify that the normal messages do work
a Wireshark trace seems to be okay aswell.
Other applications of mine do offer a working LW retained message
i did start a test-instance of mosquitto to check if there are problems with my Test-broker, that did also not help.
Thanks for your help and have a nice week
Schoschy
The text was updated successfully, but these errors were encountered: