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?
Asked
Active
Viewed 91 times
1

Chigozie A.
- 335
- 4
- 16
-
The `clientID`? – hardillb Jun 18 '19 at 13:43
-
@hardillb I see so the client ID is basically the name? I already have a client ID so I was thinking there was a way to set a name for a client like .setName("Client1) because I writing a program to test something not deploy on actual server. So I was looking for a more natural name but I think its just the clientID which I've been randomly generating for each client. – Chigozie A. Jun 18 '19 at 14:05
-
1The clientID can be anything you want (within in a given length limit), it just needs to be unique. – hardillb Jun 18 '19 at 14:06
-
@hardillb Ok I want very unique clientIDs so I will stick with randomly generating the clientID and just using simple print statements with normal names for clarity. You can leave that answer to this question. – Chigozie A. Jun 18 '19 at 14:09
1 Answers
2
The MQTT clientID
is a unique identifier for every client connected to a broker.
There is no need for any other name.

hardillb
- 54,545
- 11
- 67
- 105