@livedigital/client 3.0.9 → 3.0.10

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@livedigital/client",
3
3
  "author": "vlprojects",
4
4
  "license": "MIT",
5
- "version": "3.0.9",
5
+ "version": "3.0.10",
6
6
  "private": false,
7
7
  "bugs": {
8
8
  "url": "https://github.com/vlprojects/livedigital-sdk/issues"
@@ -47,9 +47,9 @@ class Network {
47
47
 
48
48
  public readonly eventEmitter: EnhancedEventEmitter;
49
49
 
50
- public sendTransport?: Transport;
50
+ public sendTransport?: Transport<TransportAppData>;
51
51
 
52
- public receiveTransport?: Transport;
52
+ public receiveTransport?: Transport<TransportAppData>;
53
53
 
54
54
  private readonly logger: Logger;
55
55
 
@@ -87,7 +87,19 @@ class Network {
87
87
  }
88
88
  }
89
89
 
90
+ private stopRestartIceAtempts() {
91
+ const { sendTransport, receiveTransport } = this;
92
+ if (sendTransport) {
93
+ clearInterval(sendTransport.appData.restartIceInterval);
94
+ }
95
+
96
+ if (receiveTransport) {
97
+ clearInterval(receiveTransport.appData.restartIceInterval);
98
+ }
99
+ }
100
+
90
101
  public reset() {
102
+ this.stopRestartIceAtempts();
91
103
  this.removeEventListeners();
92
104
  }
93
105
 
@@ -215,6 +227,10 @@ class Network {
215
227
  transport.appData.restartIceInterval = undefined;
216
228
  }
217
229
 
230
+ if (state === 'connected') {
231
+ setTimeout(() => this.logTransportDetails(transport), 1500);
232
+ }
233
+
218
234
  return;
219
235
  }
220
236
 
@@ -281,6 +297,10 @@ class Network {
281
297
  this.logger.debug('Stop receiveTransport.restartIce() retries', { recvTransportId: transport.id });
282
298
  clearInterval(transport.appData.restartIceInterval);
283
299
  transport.appData.restartIceInterval = undefined;
300
+
301
+ if (state === 'connected') {
302
+ setTimeout(() => this.logTransportDetails(transport), 1500);
303
+ }
284
304
  }
285
305
 
286
306
  return;
@@ -326,9 +346,9 @@ class Network {
326
346
  try {
327
347
  const iceParameters = await this.getIceParameters(transport);
328
348
  await transport.restartIce({ iceParameters });
329
- this.logger.debug('restartIce() completed', { iceParameters });
349
+ this.logger.info('restartIce completed', { iceParameters });
330
350
  } catch (error) {
331
- this.logger.error('restartIce()', { error });
351
+ this.logger.error('restartIce error', { error });
332
352
  }
333
353
  }
334
354
 
@@ -490,10 +510,9 @@ class Network {
490
510
  ) ?? [];
491
511
  const localCandidate: Record<string, unknown> | undefined = stats.get(String(pair?.localCandidateId || '-'));
492
512
  const remoteCandidate: Record<string, unknown> | undefined = stats.get(String(pair?.remoteCandidateId || '-'));
493
-
494
- this.logger.info('Detailed WebRTC transport stats', {
513
+ const detailedStats: Record<string, any> = {
495
514
  hasNominatedPair: !!pair,
496
- totalRtt: pair?.totalRoundTripTime ?? '-',
515
+ transportId: transport.id,
497
516
  iceRole: transportStats?.iceRole,
498
517
  iceState: transportStats?.iceState,
499
518
  dtlsRole: transportStats?.dtlsRole,
@@ -509,6 +528,8 @@ class Network {
509
528
  relatedAddress: localCandidate?.relatedAddress,
510
529
  relatedPort: localCandidate?.relatedPort,
511
530
  transportId: localCandidate?.transportId,
531
+ relayProtocol: localCandidate?.relayProtocol,
532
+ url: localCandidate?.url,
512
533
  },
513
534
  remote: {
514
535
  address: remoteCandidate?.address,
@@ -519,7 +540,13 @@ class Network {
519
540
  protocol: remoteCandidate?.protocol,
520
541
  transportId: remoteCandidate?.transportId,
521
542
  },
522
- });
543
+ };
544
+
545
+ if (pair?.totalRoundTripTime && pair?.responsesReceived) {
546
+ detailedStats.roundTripTime = (pair.totalRoundTripTime / pair.responsesReceived) * 1000;
547
+ }
548
+
549
+ this.logger.info('Detailed WebRTC transport stats', detailedStats);
523
550
  } catch (error: unknown) {
524
551
  this.logger.error('Failed to log detailed WebRTC transport stats', {
525
552
  error: serializeError(error),