[Question] How to set the response information property in the MQTT broker configuration

I’m trying to implement the Request/Response flow in MQTT. For this I’m trying to get the response information in the CONNACK from the server. However, as per my understanding, I need to set the response information in the broker before requesting for that. Is there any specific configuration to do that or have I missed something?

Hello @dilanSachi ,

First off, welcome to the HiveMQ Community forum! We are always excited to see new folks interested in MQTT.

Could I have you clarify a bit further on the full scope of the intended configuration?

Typically, the CONNACK packet is submitted to a connecting client in order to confirm and validate an MQTT connection request. This CONNACK packet is submitted as-per MQTT specification, and is consistent from the broker, following the same format on each connection, unless specific changes have been made to the broker via an extension.

If you are looking to see the full context of messages and packets being submitted both to and from the broker, and utilizing a self-hosted broker configuration such as a HiveMQ Community, Professional, or Enterprise installation, the HiveMQ Message Log Extension, available here, can be configured to provide all of these details within the HiveMQ log for better visibility into Broker/Client communication.

Best,
Aaron from the HiveMQ Team

Hi @AaronTLFranz . Thanks for the quick response.
When I was reading about request/response in MQTT5, I saw the following scenario [1].

To solve this problem, MQTT 5.0 defines a new attribute called response message in the CONNACK packet. The server can use this attribute to guide the client on how to choose the response topic to use. This mechanism is optional for the server and client. When connecting, the client will request the server to send response messages through setting the request-response information attribute in the CONNECT packet. This will cause the server to insert the response information attribute in the CONNACK packet, and the requestor can use response information to construct the response topic.

As I understood this, the server (broker) can send the requestor a response information that the requestor can use to build the appropriate response topic. I was wondering whether there was anyway to configure this when we setup the broker.

[1] Request Response - MQTT 5.0 new features | EMQ

Hello @dilanSachi ,

Thank you for the follow-up!

That is correct - when a client sends a CONNECT packet, it is possible to set the ‘response information’ value to true within the packet. As for how the broker handles this, this is not an implicit broker function that can be configured within the config.xml or similarly. Instead, this is handled through the implementation of a custom extension, specifically CONNECT/CONNACK interceptors, in order to modify the broker response when response information is requested during a connect scenario.

More information on how this can be implemented, and a supporting example, can be found within our extension developer guide here.

Best,
Aaron from the HiveMQ Team

1 Like

Thanks a lot @AaronTLFranz. This is quite helpful.