Supporting MQTT client identifiers with more than 23 characters
Written by The HiveMQ Team
Published: September 10, 2013
Historically, the MQTT client identifier in the CONNECT message is restricted to 23 characters in the MQTT v3.1 specification. Unfortunately there are many use cases where this artificial restriction is a burden for implementors on the client side, because many people would like to use longer client identifier, especially when they are randomly generated (An example would be using UUIDs as identifiers).
HiveMQ implements the MQTT v3.1 specification thoroughly and so this artificial limit of client identifiers with a maximum length of 23 characters was also used. Version 1.4 of HiveMQ now has support for client identifiers longer than 23 characters. In fact, the technically restricted maximum length of a client id can be 65535 characters. It is now even possible - although for most scenarios only partly useful - to limit the client id characters to a lower number.
By default, HiveMQ uses the standard MQTT limit of 23 characters to assure MQTT specification compatibility. If you are sure you want to change this behaviour, change the property global.maxClientIdLength in the configuration.properties file of your HiveMQ installation to a number you like to use.
Do you think this feature is useful? Did you have any problems with too long client ids before? We’d love to hear from you in the comments!