Search code examples
javamqtthivemq

How to get the name of a client in HiveMQ Client (MQTT)?


Is there anyway to assign a name to a client using some setter method and retrieve it with another method? So far I've been just making some methods to print statements and conversions so I've been passing in the name of clients manually as a string to a static method like PubSubUtility.printConnected("Subscriber1). I've dug into the client configuration class but it doesn't involve names only other things like quality of service. If not is there any .tostring() method I could override in a class to do this?


Solution

  • The MQTT clientID is a unique identifier for every client connected to a broker.

    There is no need for any other name.