genesys-cloud-streaming-client 17.2.4-develop.109 → 17.2.4-develop.110

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.
@@ -531,7 +531,7 @@ class Client extends events_1.default {
531
531
  stopServerLogging() {
532
532
  /* flush all pending logs and webrtc stats – then turn off the logger */
533
533
  this.logger.sendAllLogsInstantly();
534
- this._webrtcSessions.flushStats();
534
+ this._webrtcSessions.sendStatsImmediately();
535
535
  this.logger.stopServerLogging();
536
536
  }
537
537
  startServerLogging() {
@@ -64,7 +64,7 @@ export declare class WebrtcExtension extends EventEmitter implements StreamingCl
64
64
  sessionId: string;
65
65
  sessionType?: SessionTypes;
66
66
  };
67
- flushStats(): void;
67
+ sendStatsImmediately(): void;
68
68
  sendStats(): Promise<void>;
69
69
  addEventListeners(): void;
70
70
  /**
@@ -335,7 +335,7 @@ class WebrtcExtension extends events_1.EventEmitter {
335
335
  this.statBuffer += currentEventSize;
336
336
  // If it exceeds max size, don't append just send current payload.
337
337
  if (exceedsMaxStatSize) {
338
- this.flushStats();
338
+ this.sendStatsImmediately();
339
339
  }
340
340
  else {
341
341
  this.throttledSendStats();
@@ -352,11 +352,16 @@ class WebrtcExtension extends events_1.EventEmitter {
352
352
  }
353
353
  return logDetails;
354
354
  }
355
- flushStats() {
355
+ sendStatsImmediately() {
356
+ // `throttledSendStats` needs to have a scheduled exeuction for `flush` to invoke the throttled function
357
+ this.throttledSendStats();
356
358
  this.throttledSendStats.flush();
357
359
  }
358
360
  async sendStats() {
359
361
  var _a, _b;
362
+ if (!navigator.onLine) {
363
+ return;
364
+ }
360
365
  const statsToSend = [];
361
366
  let currentSize = 0;
362
367
  for (const stats of this.statsArr) {
@@ -17,6 +17,6 @@
17
17
  "file": "v17/streaming-client.browser.js"
18
18
  }
19
19
  ],
20
- "build": "109",
21
- "buildDate": "2024-08-07T21:01:41.401465775Z"
20
+ "build": "110",
21
+ "buildDate": "2024-08-22T00:48:35.301854356Z"
22
22
  }
package/dist/es/client.js CHANGED
@@ -543,7 +543,7 @@ export class Client extends EventEmitter {
543
543
  stopServerLogging() {
544
544
  /* flush all pending logs and webrtc stats – then turn off the logger */
545
545
  this.logger.sendAllLogsInstantly();
546
- this._webrtcSessions.flushStats();
546
+ this._webrtcSessions.sendStatsImmediately();
547
547
  this.logger.stopServerLogging();
548
548
  }
549
549
  startServerLogging() {
@@ -30943,7 +30943,7 @@ class WebrtcExtension extends EventEmitter {
30943
30943
  this.statBuffer += currentEventSize;
30944
30944
  // If it exceeds max size, don't append just send current payload.
30945
30945
  if (exceedsMaxStatSize) {
30946
- this.flushStats();
30946
+ this.sendStatsImmediately();
30947
30947
  }
30948
30948
  else {
30949
30949
  this.throttledSendStats();
@@ -30960,12 +30960,17 @@ class WebrtcExtension extends EventEmitter {
30960
30960
  }
30961
30961
  return logDetails;
30962
30962
  }
30963
- flushStats() {
30963
+ sendStatsImmediately() {
30964
+ // `throttledSendStats` needs to have a scheduled exeuction for `flush` to invoke the throttled function
30965
+ this.throttledSendStats();
30964
30966
  this.throttledSendStats.flush();
30965
30967
  }
30966
30968
  sendStats() {
30967
30969
  var _a, _b;
30968
30970
  return __awaiter$5(this, void 0, void 0, function* () {
30971
+ if (!navigator.onLine) {
30972
+ return;
30973
+ }
30969
30974
  const statsToSend = [];
30970
30975
  let currentSize = 0;
30971
30976
  for (const stats of this.statsArr) {
@@ -42033,7 +42038,7 @@ class Client extends EventEmitter {
42033
42038
  stopServerLogging() {
42034
42039
  /* flush all pending logs and webrtc stats – then turn off the logger */
42035
42040
  this.logger.sendAllLogsInstantly();
42036
- this._webrtcSessions.flushStats();
42041
+ this._webrtcSessions.sendStatsImmediately();
42037
42042
  this.logger.stopServerLogging();
42038
42043
  }
42039
42044
  startServerLogging() {
@@ -64,7 +64,7 @@ export declare class WebrtcExtension extends EventEmitter implements StreamingCl
64
64
  sessionId: string;
65
65
  sessionType?: SessionTypes;
66
66
  };
67
- flushStats(): void;
67
+ sendStatsImmediately(): void;
68
68
  sendStats(): Promise<void>;
69
69
  addEventListeners(): void;
70
70
  /**
package/dist/es/webrtc.js CHANGED
@@ -342,7 +342,7 @@ export class WebrtcExtension extends EventEmitter {
342
342
  this.statBuffer += currentEventSize;
343
343
  // If it exceeds max size, don't append just send current payload.
344
344
  if (exceedsMaxStatSize) {
345
- this.flushStats();
345
+ this.sendStatsImmediately();
346
346
  }
347
347
  else {
348
348
  this.throttledSendStats();
@@ -359,12 +359,17 @@ export class WebrtcExtension extends EventEmitter {
359
359
  }
360
360
  return logDetails;
361
361
  }
362
- flushStats() {
362
+ sendStatsImmediately() {
363
+ // `throttledSendStats` needs to have a scheduled exeuction for `flush` to invoke the throttled function
364
+ this.throttledSendStats();
363
365
  this.throttledSendStats.flush();
364
366
  }
365
367
  sendStats() {
366
368
  var _a, _b;
367
369
  return __awaiter(this, void 0, void 0, function* () {
370
+ if (!navigator.onLine) {
371
+ return;
372
+ }
368
373
  const statsToSend = [];
369
374
  let currentSize = 0;
370
375
  for (const stats of this.statsArr) {
@@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  # [Unreleased](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/v17.2.3...HEAD)
8
8
  * [STREAM-146](https://inindca.atlassian.net/browse/STREAM-146) - Update logging for new JSON-RPC commands.
9
+ * [STREAM-69](https://inindca.atlassian.net/browse/STREAM-69) - Don't send stats when offline and start sending stats again when online.
9
10
 
10
11
  # [v17.2.3](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/v17.2.2...v17.2.3)
11
12
  ### Fixed
@@ -531,7 +531,7 @@ class Client extends events_1.default {
531
531
  stopServerLogging() {
532
532
  /* flush all pending logs and webrtc stats – then turn off the logger */
533
533
  this.logger.sendAllLogsInstantly();
534
- this._webrtcSessions.flushStats();
534
+ this._webrtcSessions.sendStatsImmediately();
535
535
  this.logger.stopServerLogging();
536
536
  }
537
537
  startServerLogging() {
@@ -64,7 +64,7 @@ export declare class WebrtcExtension extends EventEmitter implements StreamingCl
64
64
  sessionId: string;
65
65
  sessionType?: SessionTypes;
66
66
  };
67
- flushStats(): void;
67
+ sendStatsImmediately(): void;
68
68
  sendStats(): Promise<void>;
69
69
  addEventListeners(): void;
70
70
  /**
@@ -335,7 +335,7 @@ class WebrtcExtension extends events_1.EventEmitter {
335
335
  this.statBuffer += currentEventSize;
336
336
  // If it exceeds max size, don't append just send current payload.
337
337
  if (exceedsMaxStatSize) {
338
- this.flushStats();
338
+ this.sendStatsImmediately();
339
339
  }
340
340
  else {
341
341
  this.throttledSendStats();
@@ -352,11 +352,16 @@ class WebrtcExtension extends events_1.EventEmitter {
352
352
  }
353
353
  return logDetails;
354
354
  }
355
- flushStats() {
355
+ sendStatsImmediately() {
356
+ // `throttledSendStats` needs to have a scheduled exeuction for `flush` to invoke the throttled function
357
+ this.throttledSendStats();
356
358
  this.throttledSendStats.flush();
357
359
  }
358
360
  async sendStats() {
359
361
  var _a, _b;
362
+ if (!navigator.onLine) {
363
+ return;
364
+ }
360
365
  const statsToSend = [];
361
366
  let currentSize = 0;
362
367
  for (const stats of this.statsArr) {