Adds support for 0 length client IDs. This is extremely helpful if you have more than a couple ESPs running around. Most brokers should support this- tested on libmosquitto, which has had support for this since v1.4 and also with iot.eclipse.org.
Basically if the v311 broker detects a 0 length client ID it will use libuuid to automatically generate a 16 byte UUID. This avoids having to rely on the ESPs questionable ability to generate unique, random numbers, not to mention a bit of saved memory & code complexity.
I also changed the init method to return a bool since if you have v31 set there's not much point if you dont assign a client ID. But this might break stuff for people that have left it as is.. I recommend defaulting to 311. This could probably be made a bit cleaner and I haven't tested against sdk2.0 or w/ SSL.
Example of what the broker does w v311 set and NULL passed in for client ID:
Adds support for 0 length client IDs. This is extremely helpful if you have more than a couple ESPs running around. Most brokers should support this- tested on libmosquitto, which has had support for this since v1.4 and also with iot.eclipse.org.
Basically if the v311 broker detects a 0 length client ID it will use libuuid to automatically generate a 16 byte UUID. This avoids having to rely on the ESPs questionable ability to generate unique, random numbers, not to mention a bit of saved memory & code complexity.
I also changed the init method to return a bool since if you have v31 set there's not much point if you dont assign a client ID. But this might break stuff for people that have left it as is.. I recommend defaulting to 311. This could probably be made a bit cleaner and I haven't tested against sdk2.0 or w/ SSL.
Example of what the broker does w v311 set and NULL passed in for client ID:![selection_026](https://cloud.githubusercontent.com/assets/9430255/20461853/26c33fde-aec0-11e6-9303-32d71630168c.png)