What is the best way to find out if message was delivered to broker?

Asked by Vladimir

Hello,

I recently started to use libmosquitto in C program. I am writing publisher client and now I am looking for way to find out if message was actually delivered to broker (I use QOS=1). I found out what if broker connection was lost mosquitto_publish() still return MOSQ_ERR_SUCCESS (I suppose that's because mosquitto will send it after connection will resume). But I can't understand how my client can know is message was actually received by broker? The only way I found is log_callback() function is called when message was ACKed by broker. But in log_callback() I have only a text line like this:
"Client mosq/W0t6rA:RyDW3Ms@:V^ received PUBACK (Mid: 14)"

I don't think that to parse text is a good way to look for PUBACK for specified message ID. Is there better way to do that?

Question information

Language:
English Edit question
Status:
Solved
For:
mosquitto Edit question
Assignee:
No assignee Edit question
Solved by:
Vladimir
Solved:
Last query:
Last reply:
Revision history for this message
Vladimir (v.monomah) said :
#1

The best way I found is to use mid on publish and use on_publish_calback to know about if the message was delivered