Client identifier

The client identifier is a 23 byte string that identifies an MQTT client. Each identifier must be unique to only one connected client at a time. The identifier must contain only characters valid in a queue manager name. Within these constraints, you are able to use any identification string. It is important to have a procedure for allocating client identifiers, and a means of configuring a client with its chosen identifier.

The client identifier is used in the administration of an MQTT system. With potentially hundreds of thousands of clients to administer, you need to be able to identify a particular client rapidly. Suppose for example, a device has malfunctioned, and you are notified, perhaps by a customer ringing a help desk. How does the customer identify the device, and how do you correlate that identification with the server that is typically connected to the client? Do we have to consult a database that maps each device to a client identifier and to a server? Does the name of the device identify which server it is attached to? When you browse through MQTT client connections, each connection is labeled with the client identifier. Do you need to look up a table to map a client identifier to a physical device?

Does the client identifier identify a particular device, a user, or an application running at the client? If a customer replaces a faulty device with a new one, does the new device have the same identifier as the old device? Do you allocate a new identifier? If you change a physical device, but keep the same identifier, outstanding publications and active subscriptions are automatically transferred to the new device.

How do you ensure that client identifiers are unique? As well as a system for generating unique identifiers, you must have a reliable process for setting the identifier on the client. Perhaps the client device is a "black-box", with no user interface. Do you manufacture the device with a client identifier - such as using its MAC address? Or do we have a software installation and configuration process that configures the device before it is activated?

You might create a client identifier from the 48 bit device MAC address, to keep the identifier short and unique. If transmission size is not a critical issue, you might use the remaining 17 bytes to make the address easier to administer.