diff --git a/src/Client.php b/src/Client.php index 4667604..b8e8696 100644 --- a/src/Client.php +++ b/src/Client.php @@ -294,28 +294,29 @@ public function process(null|int|float $timeout = 0, bool $reply = true, bool $c } $payload = ''; - if ($message instanceof Msg && $message->length) { - $iteration = 0; - while (strlen($payload) < $message->length) { - $payloadLine = $this->readLine($message->length, '', false); - if (!$payloadLine) { - if ($iteration > 16) { - $this->processSocketException( - new LogicException("No payload for message $message->sid") + if ($message instanceof Msg) { + if ($message->length) { + $iteration = 0; + while (strlen($payload) < $message->length) { + $payloadLine = $this->readLine($message->length, '', false); + if (!$payloadLine) { + if ($iteration > 16) { + $this->processSocketException( + new LogicException("No payload for message $message->sid") + ); + break; + } + $this->configuration->delay($iteration++); + continue; + } + if (strlen($payloadLine) != $message->length) { + $this->logger?->debug( + 'got ' . strlen($payloadLine) . '/' . $message->length . ': ' . $payloadLine ); - break; } - $this->configuration->delay($iteration++); - continue; - } - if (strlen($payloadLine) != $message->length) { - $this->logger?->debug( - 'got ' . strlen($payloadLine) . '/' . $message->length . ': ' . $payloadLine - ); + $payload .= $payloadLine; } - $payload .= $payloadLine; } - $message->parse($payload); }