fix: Resolve WebSocket authentication error, add verifyJWT alias, and implement 20s heartbeat keep-alive for permanent stable connections
This commit is contained in:
@@ -145,7 +145,7 @@ $wsWorker->onMessage = function (TcpConnection $connection, $data) use (&$userCo
|
||||
}
|
||||
|
||||
try {
|
||||
$decoded = \App\Core\Security::decodeJwt($token);
|
||||
$decoded = \App\Core\Security::verifyJWT($token);
|
||||
if (!$decoded || empty($decoded['user_id'])) {
|
||||
$connection->send(json_encode(['event' => 'auth_error', 'message' => 'Invalid or expired token']));
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user