diff --git a/src/Contracts/Connection.php b/src/Contracts/Connection.php index 295fe50f..9b13e439 100644 --- a/src/Contracts/Connection.php +++ b/src/Contracts/Connection.php @@ -60,13 +60,21 @@ public function origin(): ?string } /** - * Ping the connection to ensure it is still active. + * Mark the connection as pinged. */ public function ping(): void { $this->hasBeenPinged = true; } + /** + * Mark the connection as ponged. + */ + public function pong(): void + { + $this->hasBeenPinged = false; + } + /** * Get the last time the connection was seen. */ @@ -91,6 +99,7 @@ public function setLastSeenAt(int $time): Connection public function touch(): Connection { $this->setLastSeenAt(time()); + $this->pong(); return $this; }