1.优化ws返回参数不包含敏感字段user_id等

This commit is contained in:
2026-05-27 11:25:16 +08:00
parent b93940eaee
commit f3ed6848c7
4 changed files with 87 additions and 14 deletions

View File

@@ -126,9 +126,7 @@ class GameWebSocketServer
GameWebSocketDispatcher::sendDirect($connection, 'ws.connected', [
'message' => 'WebSocket connected',
'connection_id' => $connection->id,
'mode' => $auth['mode'],
'user_id' => $auth['user_id'],
'server_time' => time(),
'heartbeat_interval' => 30,
'idle_timeout' => self::HEARTBEAT_IDLE_SECONDS,
@@ -286,7 +284,7 @@ class GameWebSocketServer
$payload = json_encode([
'event' => 'admin.live.snapshot',
'topic' => 'admin.live.snapshot',
'data' => $snapshot,
'data' => GameWebSocketPayloadHelper::sanitizeOutboundData($snapshot),
'server_time' => time(),
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
if (!is_string($payload) || $payload === '') {