I auth tracking

This commit is contained in:
a6a2f5842 2025-09-15 10:23:07 +02:00
parent 5bd6cf2341
commit 4b7c09534a
2 changed files with 16 additions and 1 deletions

View File

@ -9,6 +9,7 @@ use BlaxSoftware\LaravelWebSockets\Server\Loggers\ConnectionLogger;
use BlaxSoftware\LaravelWebSockets\Server\Loggers\HttpLogger;
use BlaxSoftware\LaravelWebSockets\Server\Loggers\WebSocketsLogger;
use BlaxSoftware\LaravelWebSockets\ServerFactory;
use BlaxSoftware\LaravelWebSockets\Services\WebsocketService;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Cache;
use React\EventLoop\Factory as LoopFactory;
@ -89,6 +90,8 @@ class StartServer extends Command
// Fixes redis concurrency issues
config(['cache.default' => $this->option('cache-driver', 'file')]);
WebsocketService::resetAllTracking();
$this->laravel->singleton(LoopInterface::class, function () {
return $this->loop;
});

View File

@ -20,7 +20,19 @@ class WebsocketService
// );
}
function getAuth(string $socketId)
public static function resetAllTracking()
{
config(['cache.default' => 'file']);
cache()->forget('ws_active_channels');
cache()->forget('ws_socket_auth');
cache()->forget('ws_socket_auth_users');
cache()->forget('ws_channel_connections');
cache()->forget('ws_connection');
return true;
}
public static function getAuth(string $socketId)
{
config(['cache.default' => 'file']);
return cache()->get('ws_socket_auth_' . $socketId);