From 2603507b571021ca7ebc781c7efd07adfa4cb45d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Br=C3=A4utigam?= Date: Tue, 30 Jan 2024 15:35:07 +0100 Subject: [PATCH] correct unix socket connection --- src/addon/core/request.ts | 4 ++-- src/core/request.ts | 4 ++-- src/fhapi/core/request.ts | 4 ++-- src/rpc/core/request.ts | 4 ++-- src/serial/core/request.ts | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/addon/core/request.ts b/src/addon/core/request.ts index a36bbfb..75c4677 100644 --- a/src/addon/core/request.ts +++ b/src/addon/core/request.ts @@ -230,8 +230,8 @@ function getAgent(url: string, basePath: string) { const apiPath = parsedUrl.pathname; if (!socketAgents.has(apiPath)) { console.log('creating unix socket agent for', apiPath); - const unixSocketAgent = new http.Agent({ - socketPath: "/run" + apiPath, + const unixSocketAgent = new http.Agent({ + host: "ws+unix:///run" + apiPath + ":" + apiPath }); socketAgents.set(apiPath, unixSocketAgent); return unixSocketAgent; diff --git a/src/core/request.ts b/src/core/request.ts index a36bbfb..75c4677 100644 --- a/src/core/request.ts +++ b/src/core/request.ts @@ -230,8 +230,8 @@ function getAgent(url: string, basePath: string) { const apiPath = parsedUrl.pathname; if (!socketAgents.has(apiPath)) { console.log('creating unix socket agent for', apiPath); - const unixSocketAgent = new http.Agent({ - socketPath: "/run" + apiPath, + const unixSocketAgent = new http.Agent({ + host: "ws+unix:///run" + apiPath + ":" + apiPath }); socketAgents.set(apiPath, unixSocketAgent); return unixSocketAgent; diff --git a/src/fhapi/core/request.ts b/src/fhapi/core/request.ts index a36bbfb..75c4677 100644 --- a/src/fhapi/core/request.ts +++ b/src/fhapi/core/request.ts @@ -230,8 +230,8 @@ function getAgent(url: string, basePath: string) { const apiPath = parsedUrl.pathname; if (!socketAgents.has(apiPath)) { console.log('creating unix socket agent for', apiPath); - const unixSocketAgent = new http.Agent({ - socketPath: "/run" + apiPath, + const unixSocketAgent = new http.Agent({ + host: "ws+unix:///run" + apiPath + ":" + apiPath }); socketAgents.set(apiPath, unixSocketAgent); return unixSocketAgent; diff --git a/src/rpc/core/request.ts b/src/rpc/core/request.ts index a36bbfb..75c4677 100644 --- a/src/rpc/core/request.ts +++ b/src/rpc/core/request.ts @@ -230,8 +230,8 @@ function getAgent(url: string, basePath: string) { const apiPath = parsedUrl.pathname; if (!socketAgents.has(apiPath)) { console.log('creating unix socket agent for', apiPath); - const unixSocketAgent = new http.Agent({ - socketPath: "/run" + apiPath, + const unixSocketAgent = new http.Agent({ + host: "ws+unix:///run" + apiPath + ":" + apiPath }); socketAgents.set(apiPath, unixSocketAgent); return unixSocketAgent; diff --git a/src/serial/core/request.ts b/src/serial/core/request.ts index a36bbfb..75c4677 100644 --- a/src/serial/core/request.ts +++ b/src/serial/core/request.ts @@ -230,8 +230,8 @@ function getAgent(url: string, basePath: string) { const apiPath = parsedUrl.pathname; if (!socketAgents.has(apiPath)) { console.log('creating unix socket agent for', apiPath); - const unixSocketAgent = new http.Agent({ - socketPath: "/run" + apiPath, + const unixSocketAgent = new http.Agent({ + host: "ws+unix:///run" + apiPath + ":" + apiPath }); socketAgents.set(apiPath, unixSocketAgent); return unixSocketAgent;