diff --git a/src/Client.php b/src/Client.php index b8e8696..f33060d 100644 --- a/src/Client.php +++ b/src/Client.php @@ -239,7 +239,7 @@ public function process(null|int|float $timeout = 0, bool $reply = true, bool $c try { $line = $this->readLine(1024, "\r\n", $checkTimeout); - if ($line && ($this->ping || trim($line) != 'PONG')) { + if ($line && ($this->ping || trim($line) != 'PONG') && ($this->pong || trim($line) != 'PING')) { break; } if ($line === false && $ping < time()) { @@ -247,7 +247,7 @@ public function process(null|int|float $timeout = 0, bool $reply = true, bool $c $this->send(new Ping([])); $line = $this->readLine(1024, "\r\n"); $ping = time() + $this->configuration->pingInterval; - if ($line && ($this->ping || trim($line) != 'PONG')) { + if ($line && ($this->ping || trim($line) != 'PONG') && ($this->pong || trim($line) != 'PING')) { break; } } catch (Throwable $e) {