Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] When is the publish callback called?

Hi Roger.

> For QoS 0, the on_publish callback is called after a successful
> write() of the packet - so it the data has been sent to the OS for
> sending. If you're using TLS it's possible that may not mean the
> transmission is complete of course.

This makes sense.

> For QoS 1 and 2, on_publish is called in
> _mosquitto_handle_pubackcomp(), which is called when a client receives
> a PUBACK or a PUBCOMP, depending on the QoS - i.e. the final stage of
> the publish handshake in both cases.

OK. This is what I would have expected as well.

However, when I get the actual timings (start time = just before the call to mosquitto_publish, end time = in the publish callback) there doesn't appear to be much difference between the QoS 1 and 2 timings. Both are in the range of 600 - 700 microseconds. (About what I'd expect for the SBC I'm using.)

This is what prompted my question; and so I'm still scratching my head :-)

- Mark


Back to the top