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