Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Client ID autogeneration
I'd like to propose something to be added to the spec as a suggestion for people implementing MQTT clients. If a client automatically generates a client id based on a random or non-repeatable value, it should refuse to run if the clean session flag is set to false. Clients with clean session set to false (durable/persistent clients) with a random id will be unable to reconnect using the same id and so leave persistent subscriptions on the server that can never be fulfilled.
This is now implemented in the v3.1.1 spec.
This is an enhancement to the spec rather than a clarification.
The ability for the server to generate client ids would be useful in some situations. This could be achieved by the client sending a CONNECT with a zero length id. The server would generate an id and send it to the client as part of the CONNACK message. The client would always have the clean session feature enabled regardless of the setting in its CONNECT.