@shipers-dev/multi 0.67.0 → 0.69.0
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 +20 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -37388,7 +37388,7 @@ import { parseArgs } from "util";
|
|
|
37388
37388
|
// package.json
|
|
37389
37389
|
var package_default = {
|
|
37390
37390
|
name: "@shipers-dev/multi",
|
|
37391
|
-
version: "0.
|
|
37391
|
+
version: "0.69.0",
|
|
37392
37392
|
type: "module",
|
|
37393
37393
|
bin: {
|
|
37394
37394
|
"multi-agent": "./dist/index.js"
|
|
@@ -38471,11 +38471,19 @@ init_adapter_pidfile();
|
|
|
38471
38471
|
init_errors();
|
|
38472
38472
|
|
|
38473
38473
|
// src/_impl/device-link-client.ts
|
|
38474
|
+
var PING_INTERVAL_MS = 30000;
|
|
38474
38475
|
function startDeviceLinkClient(opts) {
|
|
38475
38476
|
let ws = null;
|
|
38476
38477
|
let stopped = false;
|
|
38477
38478
|
let attempt = 0;
|
|
38478
38479
|
let reconnectTimer = null;
|
|
38480
|
+
let pingTimer = null;
|
|
38481
|
+
const stopPing = () => {
|
|
38482
|
+
if (pingTimer !== null) {
|
|
38483
|
+
clearInterval(pingTimer);
|
|
38484
|
+
pingTimer = null;
|
|
38485
|
+
}
|
|
38486
|
+
};
|
|
38479
38487
|
const connect = () => {
|
|
38480
38488
|
if (stopped)
|
|
38481
38489
|
return;
|
|
@@ -38495,6 +38503,14 @@ function startDeviceLinkClient(opts) {
|
|
|
38495
38503
|
try {
|
|
38496
38504
|
socket.send(encodeFrame({ kind: "hello", cli_version: opts.cliVersion, device_id: opts.deviceId }));
|
|
38497
38505
|
} catch {}
|
|
38506
|
+
stopPing();
|
|
38507
|
+
pingTimer = setInterval(() => {
|
|
38508
|
+
if (socket.readyState !== WebSocket.OPEN)
|
|
38509
|
+
return;
|
|
38510
|
+
try {
|
|
38511
|
+
socket.send(encodeFrame({ kind: "ping" }));
|
|
38512
|
+
} catch {}
|
|
38513
|
+
}, PING_INTERVAL_MS);
|
|
38498
38514
|
});
|
|
38499
38515
|
socket.addEventListener("message", (ev) => {
|
|
38500
38516
|
const data = ev.data;
|
|
@@ -38517,6 +38533,7 @@ function startDeviceLinkClient(opts) {
|
|
|
38517
38533
|
const handleEnd = (reason) => {
|
|
38518
38534
|
if (ws === socket)
|
|
38519
38535
|
ws = null;
|
|
38536
|
+
stopPing();
|
|
38520
38537
|
opts.log(`[device-link] disconnected (${reason})`);
|
|
38521
38538
|
scheduleReconnect();
|
|
38522
38539
|
};
|
|
@@ -38553,6 +38570,7 @@ function startDeviceLinkClient(opts) {
|
|
|
38553
38570
|
clearTimeout(reconnectTimer);
|
|
38554
38571
|
reconnectTimer = null;
|
|
38555
38572
|
}
|
|
38573
|
+
stopPing();
|
|
38556
38574
|
try {
|
|
38557
38575
|
ws?.close(1000, "stopping");
|
|
38558
38576
|
} catch {}
|
|
@@ -38563,7 +38581,7 @@ function startDeviceLinkClient(opts) {
|
|
|
38563
38581
|
// package.json
|
|
38564
38582
|
var package_default2 = {
|
|
38565
38583
|
name: "@shipers-dev/multi",
|
|
38566
|
-
version: "0.
|
|
38584
|
+
version: "0.69.0",
|
|
38567
38585
|
type: "module",
|
|
38568
38586
|
bin: {
|
|
38569
38587
|
"multi-agent": "./dist/index.js"
|