favalib 0.0.1 → 0.0.2
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.
|
@@ -140,6 +140,12 @@ class SyncManager {
|
|
|
140
140
|
this.log('warning', `WebSocket closed: ${event.code} ${event.reason}`);
|
|
141
141
|
this.attemptReconnect();
|
|
142
142
|
}
|
|
143
|
+
else {
|
|
144
|
+
// Connection closed, no need to force terminate
|
|
145
|
+
if (this.terminateTimeout) {
|
|
146
|
+
clearTimeout(this.terminateTimeout);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
143
149
|
}
|
|
144
150
|
handleServerMessage(message) {
|
|
145
151
|
switch (message.type) {
|
|
@@ -558,9 +564,9 @@ class SyncManager {
|
|
|
558
564
|
const ws = this.ws;
|
|
559
565
|
this.ws = undefined;
|
|
560
566
|
ws.close();
|
|
561
|
-
// force terminate the connection after
|
|
567
|
+
// force terminate the connection after 2 seconds
|
|
562
568
|
// ws.terminate is not defined in the test enviroment, which is the reason for the &&
|
|
563
|
-
setTimeout(() => ws.terminate && ws.terminate(),
|
|
569
|
+
this.terminateTimeout = setTimeout(() => ws.terminate && ws.terminate(), 2000);
|
|
564
570
|
}
|
|
565
571
|
}
|
|
566
572
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "favalib",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -52,5 +52,8 @@
|
|
|
52
52
|
"vitest-websocket-mock": "^0.4.0",
|
|
53
53
|
"whatwg-url": "^14.0.0",
|
|
54
54
|
"ws": "^8.18.0"
|
|
55
|
+
},
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": ">=20"
|
|
55
58
|
}
|
|
56
59
|
}
|