jsgar 1.5.3 → 1.6.1
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/gar.umd.js +6 -12
- package/package.json +1 -1
package/dist/gar.umd.js
CHANGED
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
* Initialize the GAR client.
|
|
38
38
|
* @param {string} wsEndpoint - WebSocket endpoint (e.g., "ws://localhost:8765")
|
|
39
39
|
* @param {string} user - Client username for identification
|
|
40
|
-
* @param {number} [
|
|
40
|
+
* @param {number} [heartbeatTimeoutInterval=4000] - Heartbeat interval in milliseconds
|
|
41
41
|
* @param {boolean} [allowSelfSignedCertificate=false] - Allow self-signed certificates
|
|
42
42
|
* @param {string} [logLevel='INFO'] - Logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
|
|
43
43
|
*/
|
|
44
|
-
constructor(wsEndpoint, user, working_namespace = null,
|
|
44
|
+
constructor(wsEndpoint, user, working_namespace = null, heartbeatTimeoutInterval = 4000, allowSelfSignedCertificate = false, logLevel = 'INFO') {
|
|
45
45
|
this.wsEndpoint = wsEndpoint;
|
|
46
46
|
this.websocket = null;
|
|
47
47
|
this.messageQueue = [];
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
this.reconnectDelay = 5000; // Milliseconds
|
|
50
50
|
this.user = user;
|
|
51
51
|
this.working_namespace = working_namespace;
|
|
52
|
-
this.
|
|
52
|
+
this.heartbeatTimeoutInterval = heartbeatTimeoutInterval;
|
|
53
53
|
this.version = 650269;
|
|
54
54
|
|
|
55
55
|
if (typeof window !== 'undefined' && window.location) {
|
|
@@ -201,13 +201,7 @@
|
|
|
201
201
|
*/
|
|
202
202
|
_receiveMessages() {
|
|
203
203
|
this.websocket.onmessage = (event) => {
|
|
204
|
-
|
|
205
|
-
try {
|
|
206
|
-
message = JSON.parse(event.data);
|
|
207
|
-
} catch (e) {
|
|
208
|
-
this.log('ERROR', `Invalid JSON received: ${e.message}`);
|
|
209
|
-
}
|
|
210
|
-
|
|
204
|
+
const message = JSON.parse(event.data);
|
|
211
205
|
this._processMessage(message);
|
|
212
206
|
};
|
|
213
207
|
}
|
|
@@ -438,13 +432,13 @@
|
|
|
438
432
|
message_type: 'Introduction',
|
|
439
433
|
value: {
|
|
440
434
|
version: this.version,
|
|
441
|
-
heartbeat_timeout_interval: this.
|
|
435
|
+
heartbeat_timeout_interval: this.heartbeatTimeoutInterval,
|
|
442
436
|
user: this.user,
|
|
443
437
|
working_namespace: this.working_namespace
|
|
444
438
|
}
|
|
445
439
|
};
|
|
446
440
|
this.sendMessage(introMsg);
|
|
447
|
-
this.heartbeatIntervalId = setInterval(() => this._heartbeatLoop(), this.
|
|
441
|
+
this.heartbeatIntervalId = setInterval(() => this._heartbeatLoop(), this.heartbeatTimeoutInterval / 2);
|
|
448
442
|
this.connect();
|
|
449
443
|
}
|
|
450
444
|
|