diff --git a/src/Client.php b/src/Client.php index ee6cd1a..836f0cf 100644 --- a/src/Client.php +++ b/src/Client.php @@ -116,7 +116,9 @@ public function connect(): void go(fn () => $this->startConnection()); go(fn () => Timer::tick(5000, function (int $timerId) { $this->pingTimer = $timerId; - $this->getClient()->ping(); + if ($this->client->isConnected()) { + $this->getClient()->ping(); + } })); }); }