Исправить восстановление сессии после переподключения WS

This commit is contained in:
AidarKC
2026-11-15 14:35:28 +03:00
parent 70540ff041
commit e01da7ae87
4 changed files with 51 additions and 4 deletions
+5
View File
@@ -1004,9 +1004,11 @@ export class AuthService {
resetConnection(serverUrl = this.serverUrl, { clearSessionContext = true } = {}) {
const normalized = normalizeServerUrl(serverUrl);
const requestGuard = this.ws?.requestGuard;
try { this.ws?.close(); } catch {}
this.serverUrl = normalized;
this.ws = new WsJsonClient(this.serverUrl);
this.ws.setRequestGuard(requestGuard);
this.headerHashCache = new Map();
this.lineTailCache = new Map();
this.lineWriteQueues = new Map();
@@ -1185,6 +1187,7 @@ export class AuthService {
const sessionId = createResp?.payload?.sessionId;
if (!sessionId) throw new Error('CreateAuthSession: не вернулся sessionId');
this.ws.markSessionReady();
const connectionScope = String(createResp?.payload?.connectionScope || '').trim().toUpperCase();
const canonicalLogin = await this.resolveCanonicalDisplayLogin(cleanLogin);
@@ -1275,6 +1278,7 @@ export class AuthService {
const sessionId = createResp?.payload?.sessionId;
if (!sessionId) throw new Error('CreateAuthSession: не вернулся sessionId');
tempAuth.ws.markSessionReady();
const canonicalLogin = await tempAuth.resolveCanonicalDisplayLogin(cleanLogin);
@@ -1351,6 +1355,7 @@ export class AuthService {
const storagePwd = loginResp?.payload?.storagePwd;
if (!storagePwd) throw new Error('SessionLogin: не вернулся storagePwd');
this.ws.markSessionReady();
const connectionScope = String(loginResp?.payload?.connectionScope || '').trim().toUpperCase();
const canonicalLogin = await this.resolveCanonicalDisplayLogin(cleanLogin);