karpy47/PhpMqttClient

I don't understand why function sendConnect like this.MQTTClient.php:228

Closed this issue · 2 comments

My ClientID is "admin-000". I think this clientID is OK. but MQTTClient.php:228 like this,

if(preg_match("/[^0-9a-zA-Z]/",$clientId)) { $this->debugMessage('ClientId can only contain characters 0-9,a-z,A-Z'); return false; }

I think this code means that: when my $clientId like "admin-000", then report an error: "'ClientId can only contain characters 0-9,a-z,A-Z'", which I did.

Maybe this one is OK. I verify that

if(!preg_match("/[^0-9a-zA-Z]/",$clientId)) { $this->debugMessage('ClientId can only contain characters 0-9,a-z,A-Z'); return false; }

I believe that you are not allowed to use "-" in the client id according to the Mqtt 3.1 specification. Just remove it.

yeah,my mistake. Thank you!