From f5df27f96a2fa69259978b33c90359ddf2f4e1b5 Mon Sep 17 00:00:00 2001 From: a6a2f5842 Date: Wed, 15 Oct 2025 10:32:35 +0200 Subject: [PATCH] BF auth state --- src/Websocket/Handler.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Websocket/Handler.php b/src/Websocket/Handler.php index f68a305..956aa38 100644 --- a/src/Websocket/Handler.php +++ b/src/Websocket/Handler.php @@ -134,7 +134,7 @@ class Handler implements MessageComponentInterface ])); } - $this->authenticateConnection($connection, $channel); + $this->authenticateConnection($connection, $channel, $message); \Log::channel('websocket')->info('[' . $connection->socketId . ']@' . $channel->getName() . ' | ' . json_encode($message)); @@ -478,13 +478,15 @@ class Handler implements MessageComponentInterface $message = [] ) { - if (! optional($connection)->auth && $connection->socketId && cache()->get('socket_' . $connection->socketId)) { - - $cached_auth = cache()->get('socket_' . $connection->socketId); - + if ( + !optional($connection)->auth + && $connection->socketId + && ($cached_auth = cache()->get('socket_' . $connection->socketId)) + && @$cached_auth['type'] + ) { $connection->user = @$cached_auth['type']::find($cached_auth['id']); - if($channel){ + if ($channel) { $channel->saveConnection($connection); } }