Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the maximum length of client ID in MQTT?

Tags:

mqtt

is the maximum length of client ID in MQTT dependent upon the broker? If it's not, then what is the maximum number? If it is, then what is the typical maximum length for a client ID?

like image 799
Random Forkson Avatar asked Mar 09 '23 07:03

Random Forkson


1 Answers

Details of the ClientId can be found in the MQTT spec here

The important section is:

The Server MAY allow ClientId’s that contain more than 23 encoded bytes. The Server MAY allow ClientId’s that contain characters not included in the list given above.

This basically sets a soft limit of 23 bytes for the ClientId given that brokers are not required to support more than 23 bytes, but some may. (The important word being MAY as described in RFC2119)

like image 110
hardillb Avatar answered Mar 24 '23 19:03

hardillb