diff --git a/src/MQTTClient.php b/src/MQTTClient.php index ef490f2..53ca685 100644 --- a/src/MQTTClient.php +++ b/src/MQTTClient.php @@ -223,12 +223,12 @@ protected function performConnectionHandshake(string $username = null, string $p if ($username !== null) { $usernamePart = $this->buildLengthPrefixedString($username); $buffer .= $usernamePart; - $i .= strlen($usernamePart); + $i += strlen($usernamePart); } if ($password !== null) { $passwordPart = $this->buildLengthPrefixedString($password); $buffer .= $passwordPart; - $i .= strlen($passwordPart); + $i += strlen($passwordPart); } // message type and message length