hypha-rpc 0.20.59 → 0.20.60
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/hypha-rpc-websocket.js +30 -1
- package/dist/hypha-rpc-websocket.js.map +1 -1
- package/dist/hypha-rpc-websocket.min.js +1 -1
- package/dist/hypha-rpc-websocket.min.js.map +1 -1
- package/dist/hypha-rpc-websocket.min.mjs +1 -1
- package/dist/hypha-rpc-websocket.min.mjs.map +1 -1
- package/dist/hypha-rpc-websocket.mjs +30 -1
- package/dist/hypha-rpc-websocket.mjs.map +1 -1
- package/package.json +1 -1
- package/src/rpc.js +30 -1
|
@@ -566,8 +566,24 @@ class RPC extends _utils__WEBPACK_IMPORTED_MODULE_0__.MessageEmitter {
|
|
|
566
566
|
this._services = {};
|
|
567
567
|
}
|
|
568
568
|
|
|
569
|
-
|
|
569
|
+
close() {
|
|
570
|
+
// Clear all heartbeat intervals
|
|
571
|
+
for (const session_id in this._object_store) {
|
|
572
|
+
if (this._object_store.hasOwnProperty(session_id)) {
|
|
573
|
+
const session = this._object_store[session_id];
|
|
574
|
+
if (session && session.heartbeat_task) {
|
|
575
|
+
clearInterval(session.heartbeat_task);
|
|
576
|
+
}
|
|
577
|
+
if (session && session.timer) {
|
|
578
|
+
session.timer.clear();
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
}
|
|
570
582
|
this._fire("disconnected");
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
async disconnect() {
|
|
586
|
+
this.close();
|
|
571
587
|
await this._connection.disconnect();
|
|
572
588
|
}
|
|
573
589
|
|
|
@@ -1402,6 +1418,13 @@ class RPC extends _utils__WEBPACK_IMPORTED_MODULE_0__.MessageEmitter {
|
|
|
1402
1418
|
}
|
|
1403
1419
|
}
|
|
1404
1420
|
heartbeat_task = setInterval(heartbeat, promise.interval * 1000);
|
|
1421
|
+
// Store the heartbeat task in the session store for cleanup
|
|
1422
|
+
if (data.session) {
|
|
1423
|
+
const session_store = this._get_session_store(data.session, false);
|
|
1424
|
+
if (session_store) {
|
|
1425
|
+
session_store.heartbeat_task = heartbeat_task;
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1405
1428
|
}
|
|
1406
1429
|
}
|
|
1407
1430
|
|
|
@@ -1528,6 +1551,12 @@ class RPC extends _utils__WEBPACK_IMPORTED_MODULE_0__.MessageEmitter {
|
|
|
1528
1551
|
method.apply(null, args);
|
|
1529
1552
|
clearInterval(heartbeat_task);
|
|
1530
1553
|
}
|
|
1554
|
+
if (data.session) {
|
|
1555
|
+
const session_store = this._get_session_store(data.session, false);
|
|
1556
|
+
if (session_store) {
|
|
1557
|
+
delete session_store.heartbeat_task;
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1531
1560
|
} catch (err) {
|
|
1532
1561
|
if (reject) {
|
|
1533
1562
|
reject(err);
|