Using the client library is there a way to get a list of subscriptions a client has setup? I am using a persistent session and when I reconnect my client I want to make sure the list of topics my client is subscribed to is correct. If the list is not correct I want to add any subscriptions it is missing and remove any that the client should no longer subscribe to.
Hi @jonathan
Welcome to the HiveMQ Community! We’re delighted that you’re interested in MQTT and the HiveMQ broker.
Thank you for your question. Unfortunately, the hivemq-mqtt-client library alone does not provide a direct method to achieve this. The MQTT protocol, as outlined in the specifications MQTT 5.0 and 3.1.1, lacks a built-in mechanism for clients to inquire about the broker and obtain a list of active subscriptions. In the standard MQTT protocol, clients are tasked with managing their own subscriptions.
Nevertheless, some MQTT brokers, such as HiveMQ Enterprise, extend functionalities beyond the MQTT specification. In the case of HiveMQ Enterprise, it features a Broker REST API that enables programmatic interaction with the broker, including the capability to retrieve a list of client subscriptions.
I trust this information proves helpful to you.
Best regards,
Dasha from HiveMQ Team