@nextclaw/remote 0.1.73 → 0.1.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +16 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -795,6 +795,8 @@ function readRemoteConnectorSocketErrorMessage(event) {
|
|
|
795
795
|
}
|
|
796
796
|
|
|
797
797
|
// src/remote-connector.ts
|
|
798
|
+
var CONNECTOR_KEEPALIVE_INTERVAL_MS = 25e3;
|
|
799
|
+
var CONNECTOR_KEEPALIVE_FRAME = JSON.stringify({ type: "connector.ping" });
|
|
798
800
|
var RemoteConnector = class {
|
|
799
801
|
constructor(deps) {
|
|
800
802
|
this.deps = deps;
|
|
@@ -815,9 +817,14 @@ var RemoteConnector = class {
|
|
|
815
817
|
return await new Promise((resolve, reject) => {
|
|
816
818
|
const socket = this.createSocket(params.wsUrl);
|
|
817
819
|
const appAdapter = new RemoteAppAdapter(params.localOrigin, socket);
|
|
820
|
+
let keepaliveTimer = null;
|
|
818
821
|
let settled = false;
|
|
819
822
|
let aborted = false;
|
|
820
823
|
const cleanup = () => {
|
|
824
|
+
if (keepaliveTimer) {
|
|
825
|
+
clearInterval(keepaliveTimer);
|
|
826
|
+
keepaliveTimer = null;
|
|
827
|
+
}
|
|
821
828
|
params.signal?.removeEventListener("abort", onAbort);
|
|
822
829
|
};
|
|
823
830
|
const finishResolve = (value) => {
|
|
@@ -852,6 +859,15 @@ var RemoteConnector = class {
|
|
|
852
859
|
}
|
|
853
860
|
}
|
|
854
861
|
socket.addEventListener("open", () => {
|
|
862
|
+
keepaliveTimer = setInterval(() => {
|
|
863
|
+
if (socket.readyState !== 1) {
|
|
864
|
+
return;
|
|
865
|
+
}
|
|
866
|
+
try {
|
|
867
|
+
socket.send(CONNECTOR_KEEPALIVE_FRAME);
|
|
868
|
+
} catch {
|
|
869
|
+
}
|
|
870
|
+
}, CONNECTOR_KEEPALIVE_INTERVAL_MS);
|
|
855
871
|
params.statusStore?.write({
|
|
856
872
|
enabled: true,
|
|
857
873
|
state: "connected",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextclaw/remote",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.74",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Remote access runtime for NextClaw device registration, relay bridging, and service-managed connectivity.",
|
|
6
6
|
"type": "module",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"commander": "^12.1.0",
|
|
32
32
|
"ws": "^8.18.0",
|
|
33
|
-
"@nextclaw/core": "0.11.
|
|
34
|
-
"@nextclaw/server": "0.11.
|
|
33
|
+
"@nextclaw/core": "0.11.15",
|
|
34
|
+
"@nextclaw/server": "0.11.22"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^20.17.6",
|