@larksuiteoapi/node-sdk 1.24.0-beta.0 → 1.24.0-beta.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.
- package/es/index.js +13 -10
- package/lib/index.js +13 -10
- package/package.json +1 -1
- package/types/index.d.ts +1 -0
package/es/index.js
CHANGED
|
@@ -58156,10 +58156,10 @@ class WSConfig {
|
|
|
58156
58156
|
};
|
|
58157
58157
|
this.ws = {
|
|
58158
58158
|
connectUrl: '',
|
|
58159
|
-
pingInterval: 120,
|
|
58159
|
+
pingInterval: 120 * 1000,
|
|
58160
58160
|
reconnectCount: -1,
|
|
58161
|
-
reconnectInterval: 120,
|
|
58162
|
-
reconnectNonce: 30,
|
|
58161
|
+
reconnectInterval: 120 * 1000,
|
|
58162
|
+
reconnectNonce: 30 * 1000,
|
|
58163
58163
|
deviceId: '',
|
|
58164
58164
|
serviceId: '',
|
|
58165
58165
|
autoReconnect: true
|
|
@@ -58331,10 +58331,10 @@ class WSClient {
|
|
|
58331
58331
|
connectUrl: URL,
|
|
58332
58332
|
deviceId: device_id,
|
|
58333
58333
|
serviceId: service_id,
|
|
58334
|
-
pingInterval: ClientConfig.PingInterval,
|
|
58334
|
+
pingInterval: ClientConfig.PingInterval * 1000,
|
|
58335
58335
|
reconnectCount: ClientConfig.ReconnectCount,
|
|
58336
|
-
reconnectInterval: ClientConfig.ReconnectInterval,
|
|
58337
|
-
reconnectNonce: ClientConfig.ReconnectNonce
|
|
58336
|
+
reconnectInterval: ClientConfig.ReconnectInterval * 1000,
|
|
58337
|
+
reconnectNonce: ClientConfig.ReconnectNonce * 1000
|
|
58338
58338
|
});
|
|
58339
58339
|
this.logger.debug('[ws]', `get connect config success, ws url: ${URL}`);
|
|
58340
58340
|
return true;
|
|
@@ -58374,6 +58374,9 @@ class WSClient {
|
|
|
58374
58374
|
return Promise.resolve(false);
|
|
58375
58375
|
});
|
|
58376
58376
|
};
|
|
58377
|
+
if (this.pingInterval) {
|
|
58378
|
+
clearTimeout(this.pingInterval);
|
|
58379
|
+
}
|
|
58377
58380
|
if (isStart) {
|
|
58378
58381
|
const isSuccess = yield tryConnect();
|
|
58379
58382
|
if (!isSuccess) {
|
|
@@ -58432,7 +58435,7 @@ class WSClient {
|
|
|
58432
58435
|
this.sendMessage(frame);
|
|
58433
58436
|
this.logger.trace('[ws]', 'ping success');
|
|
58434
58437
|
}
|
|
58435
|
-
setTimeout(this.pingLoop.bind(this), pingInterval);
|
|
58438
|
+
this.pingInterval = setTimeout(this.pingLoop.bind(this), pingInterval);
|
|
58436
58439
|
}
|
|
58437
58440
|
communicate() {
|
|
58438
58441
|
const wsInstance = this.wsConfig.getWSInstance();
|
|
@@ -58467,10 +58470,10 @@ class WSClient {
|
|
|
58467
58470
|
const dataString = new TextDecoder("utf-8").decode(payload);
|
|
58468
58471
|
const { PingInterval, ReconnectCount, ReconnectInterval, ReconnectNonce } = JSON.parse(dataString);
|
|
58469
58472
|
this.wsConfig.updateWs({
|
|
58470
|
-
pingInterval: PingInterval,
|
|
58473
|
+
pingInterval: PingInterval * 1000,
|
|
58471
58474
|
reconnectCount: ReconnectCount,
|
|
58472
|
-
reconnectInterval: ReconnectInterval,
|
|
58473
|
-
reconnectNonce: ReconnectNonce,
|
|
58475
|
+
reconnectInterval: ReconnectInterval * 1000,
|
|
58476
|
+
reconnectNonce: ReconnectNonce * 1000,
|
|
58474
58477
|
});
|
|
58475
58478
|
this.logger.trace('[ws]', 'update wsConfig with pong data');
|
|
58476
58479
|
}
|
package/lib/index.js
CHANGED
|
@@ -58173,10 +58173,10 @@ class WSConfig {
|
|
|
58173
58173
|
};
|
|
58174
58174
|
this.ws = {
|
|
58175
58175
|
connectUrl: '',
|
|
58176
|
-
pingInterval: 120,
|
|
58176
|
+
pingInterval: 120 * 1000,
|
|
58177
58177
|
reconnectCount: -1,
|
|
58178
|
-
reconnectInterval: 120,
|
|
58179
|
-
reconnectNonce: 30,
|
|
58178
|
+
reconnectInterval: 120 * 1000,
|
|
58179
|
+
reconnectNonce: 30 * 1000,
|
|
58180
58180
|
deviceId: '',
|
|
58181
58181
|
serviceId: '',
|
|
58182
58182
|
autoReconnect: true
|
|
@@ -58348,10 +58348,10 @@ class WSClient {
|
|
|
58348
58348
|
connectUrl: URL,
|
|
58349
58349
|
deviceId: device_id,
|
|
58350
58350
|
serviceId: service_id,
|
|
58351
|
-
pingInterval: ClientConfig.PingInterval,
|
|
58351
|
+
pingInterval: ClientConfig.PingInterval * 1000,
|
|
58352
58352
|
reconnectCount: ClientConfig.ReconnectCount,
|
|
58353
|
-
reconnectInterval: ClientConfig.ReconnectInterval,
|
|
58354
|
-
reconnectNonce: ClientConfig.ReconnectNonce
|
|
58353
|
+
reconnectInterval: ClientConfig.ReconnectInterval * 1000,
|
|
58354
|
+
reconnectNonce: ClientConfig.ReconnectNonce * 1000
|
|
58355
58355
|
});
|
|
58356
58356
|
this.logger.debug('[ws]', `get connect config success, ws url: ${URL}`);
|
|
58357
58357
|
return true;
|
|
@@ -58391,6 +58391,9 @@ class WSClient {
|
|
|
58391
58391
|
return Promise.resolve(false);
|
|
58392
58392
|
});
|
|
58393
58393
|
};
|
|
58394
|
+
if (this.pingInterval) {
|
|
58395
|
+
clearTimeout(this.pingInterval);
|
|
58396
|
+
}
|
|
58394
58397
|
if (isStart) {
|
|
58395
58398
|
const isSuccess = yield tryConnect();
|
|
58396
58399
|
if (!isSuccess) {
|
|
@@ -58449,7 +58452,7 @@ class WSClient {
|
|
|
58449
58452
|
this.sendMessage(frame);
|
|
58450
58453
|
this.logger.trace('[ws]', 'ping success');
|
|
58451
58454
|
}
|
|
58452
|
-
setTimeout(this.pingLoop.bind(this), pingInterval);
|
|
58455
|
+
this.pingInterval = setTimeout(this.pingLoop.bind(this), pingInterval);
|
|
58453
58456
|
}
|
|
58454
58457
|
communicate() {
|
|
58455
58458
|
const wsInstance = this.wsConfig.getWSInstance();
|
|
@@ -58484,10 +58487,10 @@ class WSClient {
|
|
|
58484
58487
|
const dataString = new TextDecoder("utf-8").decode(payload);
|
|
58485
58488
|
const { PingInterval, ReconnectCount, ReconnectInterval, ReconnectNonce } = JSON.parse(dataString);
|
|
58486
58489
|
this.wsConfig.updateWs({
|
|
58487
|
-
pingInterval: PingInterval,
|
|
58490
|
+
pingInterval: PingInterval * 1000,
|
|
58488
58491
|
reconnectCount: ReconnectCount,
|
|
58489
|
-
reconnectInterval: ReconnectInterval,
|
|
58490
|
-
reconnectNonce: ReconnectNonce,
|
|
58492
|
+
reconnectInterval: ReconnectInterval * 1000,
|
|
58493
|
+
reconnectNonce: ReconnectNonce * 1000,
|
|
58491
58494
|
});
|
|
58492
58495
|
this.logger.trace('[ws]', 'update wsConfig with pong data');
|
|
58493
58496
|
}
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -152010,6 +152010,7 @@ declare class WSClient {
|
|
|
152010
152010
|
private dataCache;
|
|
152011
152011
|
private httpInstance;
|
|
152012
152012
|
private eventDispatcher?;
|
|
152013
|
+
private pingInterval?;
|
|
152013
152014
|
constructor(params: IConstructorParams);
|
|
152014
152015
|
private pullConnectConfig;
|
|
152015
152016
|
private connect;
|