From 66d16d29d1fcd9e023afcfb43497384317f3ff8e Mon Sep 17 00:00:00 2001 From: slavarazum Date: Thu, 27 Apr 2023 15:45:22 +0000 Subject: [PATCH] Refactor code --- src/Listeners/RemoveStoredConnectionListener.php | 2 +- src/RedisSubscriber.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Listeners/RemoveStoredConnectionListener.php b/src/Listeners/RemoveStoredConnectionListener.php index 9b86c26..28e918c 100644 --- a/src/Listeners/RemoveStoredConnectionListener.php +++ b/src/Listeners/RemoveStoredConnectionListener.php @@ -15,7 +15,7 @@ public function __construct(private PresenceChannelUsersRepository $store) public function handle(SseConnectionClosedEvent $event) { - if ($event->user === null) { + if (!$event->user instanceof \Illuminate\Contracts\Auth\Authenticatable) { return; } diff --git a/src/RedisSubscriber.php b/src/RedisSubscriber.php index e083327..8f59c2f 100644 --- a/src/RedisSubscriber.php +++ b/src/RedisSubscriber.php @@ -17,7 +17,7 @@ public function start(Closure $onMessage, Request $request) $connection = Redis::connection("$redisConnectionName-subscription"); register_shutdown_function(function () use ($request, $connection) { - if (connection_aborted()) { + if (connection_aborted() !== 0) { event(new SseConnectionClosedEvent($request->user(), $request->header('X-Socket-Id'))); }