question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using M2Mqtt as a client that connects with willRetain flag ON, does not retain the message.

//ID, User, Pass, WillRetain, WillQoS, WillFlag, WillTopic, WillMessage, Clean, KeepAlive client.Connect(clientID, null, null, true, MqttMsgBase.QOS_LEVEL_AT_LEAST_ONCE, true, "State/lastWill", "online", true, 3);

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
dtflx01commented, Mar 17, 2017

Hi, I had the same problem. If you publish a message before connecting to the Broker, the value is never published. I added a wrapper in my program around M2Mqtt to store the messages and values in a dictionary. Then OnConnect I re-publish automatically the last messages/values automatically. Then it works. It would be great to add this feature in M2Mqtt library. Regards

0reactions
JayEnaRcommented, Nov 23, 2017

You are correct. This broker needs an update.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is MQTT Last Will and Testament (LWT)?
It becomes a powerful tool for storing and communicating client state on specific topics when combined with retained messages. For instance, by ...
Read more >
MQTT Last Will Explained + Example
'Last will and testament' is a legal document that determines how the person's possessions will be distributed in the event of death. 'Will...
Read more >
MQTT Last Will and Testament Use and Examples
The last will and testament message is used to notify subscribers of an unexpected shut down of the publisher. Here we look at...
Read more >
Where to store a last will
The most important thing to remember is, no matter where you decide to keep the original copy of your will, to tell your...
Read more >
MQTT what is the purpose or usage of Last Will Testament?
The Last Will and Testament feature is used in MQTT to notify other clients about an ungracefully disconnected client. MQTT is often used...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found