fix: Resolve WebSocket authentication error, add verifyJWT alias, and implement 20s heartbeat keep-alive for permanent stable connections

This commit is contained in:
Hamza-Ayed
2026-08-27 03:39:57 +03:00
parent 596f5e6603
commit b11a4bd8c1
4 changed files with 53 additions and 10 deletions
+1 -1
View File
@@ -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;