fix(app): preserve socket capabilities on adopted probe clients

This commit is contained in:
Mohamed Boudra
2026-10-30 17:56:57 +01:00
parent b044201f62
commit 41d9bb4294
2 changed files with 21 additions and 0 deletions
@@ -76,6 +76,25 @@ describe("test-daemon-connection connectToDaemon", () => {
probe = new FakeDaemonProbe();
});
it.each([
{ id: "direct:lan:6767", type: "directTcp" as const, endpoint: "lan:6767" },
{
id: "relay:test",
type: "relay" as const,
relayEndpoint: "relay.paseo.sh:443",
daemonPublicKeyB64: "pubkey",
},
])("adoptable $type probe clients use the app WebSocket factory", async (connection) => {
const { connectToDaemon } = await import("./test-daemon-connection");
const { createAppWebSocketFactory } = await import("@/runtime/websocket-factory");
const result = await connectToDaemon(connection, { serverId: "srv_probe_test" }, probe.deps);
try {
expect(result.client.config.webSocketFactory).toBe(createAppWebSocketFactory());
} finally {
await result.client.close();
}
});
it("reuses the app clientId for direct connections", async () => {
const { connectToDaemon } = await import("./test-daemon-connection");
const first = await connectToDaemon(
@@ -6,6 +6,7 @@ import {
} from "@getpaseo/client/internal/daemon-client";
import type { DaemonClientConfig } from "@getpaseo/client/internal/daemon-client";
import type { HostConnection } from "@/types/host-connection";
import { createAppWebSocketFactory } from "@/runtime/websocket-factory";
import { getOrCreateClientId } from "./client-id";
import { resolveAppVersion } from "./app-version";
import {
@@ -156,6 +157,7 @@ export async function buildClientConfig(
clientType: "mobile" as const,
appVersion: deps.resolveAppVersion() ?? undefined,
suppressSendErrors: true,
webSocketFactory: createAppWebSocketFactory(),
reconnect: { enabled: false },
...resolveConnectionCredentials(connection, options),
...(options.capabilities ? { capabilities: options.capabilities } : {}),