Report
3 years, 4 months ago.

Missing Void* reference in subscribe callback

Hey,

I started writing an application using the Paho Embedded C++/C client libs. Everything works as expected, except of the subscribe callbacks.

Since my software is written in C++, I can't find a way to pass a context variable into the callback. So currently don't see a way to access my objects from within the callback.

I've seen in the API of the Paho MQTT C Client for Unix / Mac / Windows that it accepts for example a void* to pass the context into the callback. See: http://www.eclipse.org/paho/files/mqttdoc/Cclient/_m_q_t_t_client_8h.html#aad27d07782991a4937ebf2f39a021f83

Am I missing something or what is the best strategy to access objects outside of the callback?

The only thing I could think is some static variables in a class.

Any hints are very much appreciated, Tobias

Question relating to:

Working on MQTT, a machine-to-machine (M2M) "Internet of Things" connectivity protocol.
Comment on this question
Be the first to answer this question.

To post an answer, please log in.