feat(gateway)!: switch handshake to req:connect (protocol v2)

This commit is contained in:
Peter Steinberger
2025-12-12 23:29:57 +00:00
parent e915ed182d
commit d5d80f4247
26 changed files with 586 additions and 955 deletions
+7 -3
View File
@@ -29,11 +29,13 @@ describe("GatewayClient", () => {
wss = new WebSocketServer({ port, host: "127.0.0.1" });
wss.on("connection", (socket) => {
socket.once("message", () => {
socket.once("message", (data) => {
const first = JSON.parse(String(data)) as { id?: string };
const id = first.id ?? "connect";
// Respond with tiny tick interval to trigger watchdog quickly.
const helloOk = {
type: "hello-ok",
protocol: 1,
protocol: 2,
server: { version: "dev", connId: "c1" },
features: { methods: [], events: [] },
snapshot: {
@@ -48,7 +50,9 @@ describe("GatewayClient", () => {
tickIntervalMs: 5,
},
};
socket.send(JSON.stringify(helloOk));
socket.send(
JSON.stringify({ type: "res", id, ok: true, payload: helloOk }),
);
});
});