From 11bf33ba776f66dea26281f74a529f967841165d Mon Sep 17 00:00:00 2001 From: RICHARD TAYLOR Date: Sat, 26 Oct 2024 09:39:27 +0100 Subject: [PATCH 1/2] Enable serialization of connection --- src/Connection.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Connection.php b/src/Connection.php index 6452f529..f778a4df 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -3,13 +3,14 @@ namespace Laravel\Reverb; use Laravel\Reverb\Concerns\GeneratesIdentifiers; +use Laravel\Reverb\Concerns\SerializesConnections; use Laravel\Reverb\Contracts\Connection as ConnectionContract; use Laravel\Reverb\Events\MessageSent; use Ratchet\RFC6455\Messaging\Frame; class Connection extends ConnectionContract { - use GeneratesIdentifiers; + use GeneratesIdentifiers, SerializesConnections; /** * The normalized socket ID. From 8252f5b0a6b282f119eb96b0021d1397fddf524e Mon Sep 17 00:00:00 2001 From: RICHARD TAYLOR Date: Sat, 26 Oct 2024 12:05:58 +0100 Subject: [PATCH 2/2] Exclude underlying websocket raw identifier from serialization --- src/Concerns/SerializesConnections.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Concerns/SerializesConnections.php b/src/Concerns/SerializesConnections.php index 982b4f26..0ade4580 100644 --- a/src/Concerns/SerializesConnections.php +++ b/src/Concerns/SerializesConnections.php @@ -15,7 +15,6 @@ public function __serialize(): array { return [ 'id' => $this->id(), - 'identifier' => $this->identifier(), 'application' => $this->app()->id(), 'origin' => $this->origin(), 'lastSeenAt' => $this->lastSeenAt, @@ -29,7 +28,6 @@ public function __serialize(): array public function __unserialize(array $values): void { $this->id = $values['id']; - $this->identifier = $values['identifier']; $this->application = app(ApplicationProvider::class)->findById($values['application']); $this->origin = $values['origin']; $this->lastSeenAt = $values['lastSeenAt'] ?? null;