I'm trying to use libmosquitto to make a request (publish to a 'test/topic'
topic) and I want to get a response based on the client (sender) id. So that means the client will publish to 'test/topic'
and it will automatically subscribe 'test/topic/<client_id>'
The server has already subscribed on 'test/topic'
and when it becomes the message, it will send a response (publish) to 'test/topic/<client_id>'
, which the client subscribed to receive that response in the first place.
The challenge here is how do I get the <client_id>
, right. I already done this in python and js, where the client will send metadata or properties in the payload, which the server can unpack to get the client_id. However, I'm using C++ now and it's frustrating because I can't figure out how to get these properties.
Here is an example of how to do this in python. I just want to do the same with c++
I'm using the libmosquitto as I mentionned. I don't even have an example to show because I didn't find how to do this. There is literally no example on how to do this with the mosquitto c++ lib (which is confusing since mosquitto is a famous lib I guess).
I hope someone had a similar problem or can post an example for c++ and mosquitto lib. Thanks in advance.