gateway: enforce hello order and modern json

This commit is contained in:
Peter Steinberger
2025-12-09 19:09:06 +00:00
parent c41b506741
commit ab9b12e883
2 changed files with 18 additions and 18 deletions

View File

@@ -312,8 +312,6 @@ export async function startGatewayServer(port = 18789): Promise<GatewayServer> {
return;
}
client = { socket, hello, connId };
clients.add(client);
// synthesize presence entry for this connection (client fingerprint)
const presenceKey = hello.client.instanceId || connId;
const remoteAddr = (
@@ -354,7 +352,11 @@ export async function startGatewayServer(port = 18789): Promise<GatewayServer> {
},
};
clearTimeout(handshakeTimer);
// Add the client only after the hello response is ready so no tick/presence
// events reach it before the handshake completes.
client = { socket, hello, connId };
send(helloOk);
clients.add(client);
return;
}