I auth state
This commit is contained in:
parent
dcf8315290
commit
447cc71256
|
|
@ -150,7 +150,6 @@ class Handler implements MessageComponentInterface
|
||||||
$pid = pcntl_fork();
|
$pid = pcntl_fork();
|
||||||
|
|
||||||
if ($pid == -1) {
|
if ($pid == -1) {
|
||||||
Auth::logout();
|
|
||||||
Log::error('Fork error');
|
Log::error('Fork error');
|
||||||
} elseif ($pid == 0) {
|
} elseif ($pid == 0) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -182,7 +181,6 @@ class Handler implements MessageComponentInterface
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
} else {
|
} else {
|
||||||
Auth::logout();
|
|
||||||
$this->addDataCheckLoop($connection, $message, $pid);
|
$this->addDataCheckLoop($connection, $message, $pid);
|
||||||
}
|
}
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
|
|
@ -250,8 +248,6 @@ class Handler implements MessageComponentInterface
|
||||||
cache()->forget('ws_connection_' . $connection->socketId);
|
cache()->forget('ws_connection_' . $connection->socketId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Auth::logout();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -479,6 +475,7 @@ class Handler implements MessageComponentInterface
|
||||||
protected function authenticateConnection(
|
protected function authenticateConnection(
|
||||||
ConnectionInterface $connection,
|
ConnectionInterface $connection,
|
||||||
PrivateChannel|Channel|PresenceChannel|null $channel,
|
PrivateChannel|Channel|PresenceChannel|null $channel,
|
||||||
|
array|null|mixed $message = []
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (! optional($connection)->auth && $connection->socketId && cache()->get('socket_' . $connection->socketId)) {
|
if (! optional($connection)->auth && $connection->socketId && cache()->get('socket_' . $connection->socketId)) {
|
||||||
|
|
@ -519,6 +516,11 @@ class Handler implements MessageComponentInterface
|
||||||
$authed_users = cache()->get('ws_socket_authed_users') ?? [];
|
$authed_users = cache()->get('ws_socket_authed_users') ?? [];
|
||||||
$authed_users[$connection->socketId] = $user->id;
|
$authed_users[$connection->socketId] = $user->id;
|
||||||
cache()->forever('ws_socket_authed_users', $authed_users);
|
cache()->forever('ws_socket_authed_users', $authed_users);
|
||||||
|
|
||||||
|
\BlaxSoftware\LaravelWebSockets\Services\WebsocketService::setUserAuthed(
|
||||||
|
$connection->socketId,
|
||||||
|
$user
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add next in loop logout
|
// add next in loop logout
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue