





























@@ -1343,44 +1343,6 @@ export function attachGatewayWsMessageHandler(params: {
13431343});
13441344incrementPresenceVersion();
13451345}
1346-const snapshot = buildGatewaySnapshot({
1347-includeSensitive: scopes.includes(ADMIN_SCOPE),
1348-});
1349-const cachedHealth = getHealthCache();
1350-if (cachedHealth) {
1351-snapshot.health = cachedHealth;
1352-snapshot.stateVersion.health = getHealthVersion();
1353-}
1354-const helloOkAuthScopes = deviceToken ? deviceToken.scopes : scopes;
1355-const helloOk = {
1356-type: "hello-ok",
1357-protocol: PROTOCOL_VERSION,
1358-server: {
1359-version: resolveRuntimeServiceVersion(process.env),
1360- connId,
1361-},
1362-features: { methods: gatewayMethods, events },
1363- snapshot,
1364-canvasHostUrl: scopedCanvasHostUrl,
1365-auth: {
1366- role,
1367-scopes: helloOkAuthScopes,
1368- ...(deviceToken
1369- ? {
1370-deviceToken: deviceToken.token,
1371-issuedAtMs: deviceToken.rotatedAtMs ?? deviceToken.createdAtMs,
1372- ...(bootstrapDeviceTokens.length > 1
1373- ? { deviceTokens: bootstrapDeviceTokens.slice(1) }
1374- : {}),
1375-}
1376- : {}),
1377-},
1378-policy: {
1379-maxPayload: MAX_PAYLOAD_BYTES,
1380-maxBufferedBytes: MAX_BUFFERED_BYTES,
1381-tickIntervalMs: TICK_INTERVAL_MS,
1382-},
1383-};
13841346if (role === "node") {
13851347const context = buildRequestContext();
13861348const nodeSession = context.nodeRegistry.register(nextClient, {
@@ -1442,6 +1404,45 @@ export function attachGatewayWsMessageHandler(params: {
14421404);
14431405}
144414061407+const snapshot = buildGatewaySnapshot({
1408+includeSensitive: scopes.includes(ADMIN_SCOPE),
1409+});
1410+const cachedHealth = getHealthCache();
1411+if (cachedHealth) {
1412+snapshot.health = cachedHealth;
1413+snapshot.stateVersion.health = getHealthVersion();
1414+}
1415+const helloOkAuthScopes = deviceToken ? deviceToken.scopes : scopes;
1416+const helloOk = {
1417+type: "hello-ok",
1418+protocol: PROTOCOL_VERSION,
1419+server: {
1420+version: resolveRuntimeServiceVersion(process.env),
1421+ connId,
1422+},
1423+features: { methods: gatewayMethods, events },
1424+ snapshot,
1425+canvasHostUrl: scopedCanvasHostUrl,
1426+auth: {
1427+ role,
1428+scopes: helloOkAuthScopes,
1429+ ...(deviceToken
1430+ ? {
1431+deviceToken: deviceToken.token,
1432+issuedAtMs: deviceToken.rotatedAtMs ?? deviceToken.createdAtMs,
1433+ ...(bootstrapDeviceTokens.length > 1
1434+ ? { deviceTokens: bootstrapDeviceTokens.slice(1) }
1435+ : {}),
1436+}
1437+ : {}),
1438+},
1439+policy: {
1440+maxPayload: MAX_PAYLOAD_BYTES,
1441+maxBufferedBytes: MAX_BUFFERED_BYTES,
1442+tickIntervalMs: TICK_INTERVAL_MS,
1443+},
1444+};
1445+14451446try {
14461447await sendFrame({ type: "res", id: frame.id, ok: true, payload: helloOk });
14471448} catch (err) {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。