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

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.
@@ -529,9 +529,8 @@ class Client extends events_1.default {
529
529
  }
530
530
  }
531
531
  stopServerLogging() {
532
- /* flush all pending logs and webrtc stats – then turn off the logger */
532
+ /* flush all pending logs – then turn off the logger */
533
533
  this.logger.sendAllLogsInstantly();
534
- this._webrtcSessions.flushStats();
535
534
  this.logger.stopServerLogging();
536
535
  }
537
536
  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
  /**
@@ -289,10 +289,6 @@ class WebrtcExtension extends events_1.EventEmitter {
289
289
  // This should be moved when the sdk is the primary consumer
290
290
  proxyStatsForSession(session) {
291
291
  session.on('stats', (statsEvent) => {
292
- /* if our logger was stopped, we need to stop stats logging too */
293
- if (this.client.logger['stopReason']) {
294
- return;
295
- }
296
292
  const statsCopy = JSON.parse(JSON.stringify(statsEvent));
297
293
  const extraDetails = {
298
294
  conversationId: session.conversationId,
@@ -335,7 +331,7 @@ class WebrtcExtension extends events_1.EventEmitter {
335
331
  this.statBuffer += currentEventSize;
336
332
  // If it exceeds max size, don't append just send current payload.
337
333
  if (exceedsMaxStatSize) {
338
- this.flushStats();
334
+ this.sendStatsImmediately();
339
335
  }
340
336
  else {
341
337
  this.throttledSendStats();
@@ -352,11 +348,16 @@ class WebrtcExtension extends events_1.EventEmitter {
352
348
  }
353
349
  return logDetails;
354
350
  }
355
- flushStats() {
351
+ sendStatsImmediately() {
352
+ // `throttledSendStats` needs to have a scheduled exeuction for `flush` to invoke the throttled function
353
+ this.throttledSendStats();
356
354
  this.throttledSendStats.flush();
357
355
  }
358
356
  async sendStats() {
359
357
  var _a, _b;
358
+ if (!navigator.onLine) {
359
+ return;
360
+ }
360
361
  const statsToSend = [];
361
362
  let currentSize = 0;
362
363
  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": "111",
21
+ "buildDate": "2024-08-29T18:23:46.793346362Z"
22
22
  }
package/dist/es/client.js CHANGED
@@ -541,9 +541,8 @@ export class Client extends EventEmitter {
541
541
  });
542
542
  }
543
543
  stopServerLogging() {
544
- /* flush all pending logs and webrtc stats – then turn off the logger */
544
+ /* flush all pending logs – then turn off the logger */
545
545
  this.logger.sendAllLogsInstantly();
546
- this._webrtcSessions.flushStats();
547
546
  this.logger.stopServerLogging();
548
547
  }
549
548
  startServerLogging() {