async-mqtt5 icon indicating copy to clipboard operation
async-mqtt5 copied to clipboard

How to access to retain flag value after received a message with async_receive ?

Open MelvinWarnet opened this issue 2 months ago • 2 comments

Hello,

I'm new to this library and to MQTT in general. But I search a lot and don't find any answer to my question.

After receiving a message from my broker I want to check if this one was a retain message or not. I thought that it will exist a manner to access to the retain flag value of the message received but I didn't find anything like this.

Please tell me if I have not be clear enough.

MelvinWarnet avatar Nov 04 '25 10:11 MelvinWarnet

Hello,

Unfortunately, we don't currently forward the retain flag. Adding support for this would likely require changing the async_receive completion signature.

I'm also curious about your use case, since the retain flag is primarily meaningful to the broker.

biljazovic avatar Nov 05 '25 10:11 biljazovic

Hello @biljazovic,

Thanks for your reply, it's clear. I don't really have use case for now because I'm principally discovering the protocol and the lib. I was just wandering if it was possible. But I imagine that a client may process the information differently if it is a retain message.

Have a nice day

MelvinWarnet avatar Nov 05 '25 15:11 MelvinWarnet