Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
无论如何使用一些setter方法为客户端分配一个名称并用另一种方法检索它?到目前为止,我一直在制作一些打印语句和转换的方法,所以我一直在手动将客户端的名称作为字符串传递给静态方法,例如PubSubUtility.printConnected("Subscriber1). 我已经深入研究了客户端配置类,但它不涉及名称,仅涉及服务质量等其他内容。如果没有,我可以在一个类中重写任何 .tostring() 方法来执行此操作吗?
PubSubUtility.printConnected("Subscriber1)
MQTTclientID是连接到代理的每个客户端的唯一标识符。
clientID
不需要任何其他名称。