Connect fail due to malformed mqtt packet when msg len is larger than 127
Closed this issue · 0 comments
cstang02 commented
Hello, thanks for providing such a good mqtt client.
I encountered an issue when the remaining length is larger than 127 in the CONNECT COMMAND (by using long clientId, username and password).
The reason is that you are using only 1 byte to present the Remaining Length of the CONNECT COMMAND, while the protocols says we should use 1~4 bytes.
So I changed Client.php's code in 218,
from: $header = chr(0x10).chr($i);
to: $header = $this->createHeader(0x10, $i);
and the problem was fixed.