-
Notifications
You must be signed in to change notification settings - Fork 446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LWT Will message is not complete #378
Comments
That's odd... The LWT message goes to the broker inside the initial connect message. After that the client has nothing to do with its delivery. Can you spy on the packets with Wireshark or something to see if the connect message seems properly formed? (i.e. has the whole LWT payload?) And, it would be pretty odd for the connection to be accepted if the connect message was malformed. |
Here is a copy of the information presented by Wireshark.
If there is further information in the Wireshark capture, you will need to guide me as to how to present it as I am not that conversant with Wireshark. I don't see any indication in the entire transaction or the Mosquitto broker log indicating that there is anything malformed in the communication. (And except for the inserted Edit: I have been negligent in not mentioning that I am building against the The C++ package built from the repo and linked against Debian (Bullseye) package Thanks! |
No that's shows what I was wondering about:
So, the client (app or library) is giving the broker a LWT message with a payload that has only one character. Can you post a code snippet for the client? Is it literally the example app with an |
It is literally the sample app with the |
// message.h
message(string_ref topic, const void* payload, size_t len)
: message(std::move(topic), payload, len, DFLT_QOS, DFLT_RETAINED) {}
message(string_ref topic, const void* payload, size_t len,
int qos, bool retained,
const properties& props=properties());
// async_publish.cpp
const char* LWT_PAYLOAD = "Last will and testament.";
const int QOS = 1;
auto connOpts = mqtt::connect_options_builder()
.clean_session()
.will(mqtt::message(TOPIC, LWT_PAYLOAD, QOS))
.finalize(); It seems that there is a problem with the sample writing. auto connOpts = mqtt::connect_options_builder()
.clean_session()
.will(mqtt::message(TOPIC, LWT_PAYLOAD, strlen(LWT_PAYLOAD), QOS, /*retained*/true))
.finalize(); |
🤦 Only took a year... Now I see it. Yeah, I used QoS for the LWT message length parameter! Thanks for the help. I'll get the fix in now... |
Fixed in v1.3.2 |
Testing with sample code
async_publish.cpp
and insertingabort()
at line 195 to cause the program to abort w/out cleaning up the connection (and thus causing the broker to publish the will message.) Only the first character of the will message is published. Example output from another client listening to the same broker isOutput form the program itself is
And command to build the program is
I have tested the C library similarly (inserting
abort()
at line 509 inpaho_c_pub.c
) and verified that the entire will message is printed.The text was updated successfully, but these errors were encountered: