@yz-social/webrtc 0.1.11 → 0.1.12

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.
Files changed (2) hide show
  1. package/index.js +4 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -30,7 +30,7 @@ export class WebRTC {
30
30
  // Number of instances at a time (if previous have been garbage collected), as of 1/27/26:
31
31
  static suggestedInstancesLimit =
32
32
  globalThis.navigator.vendor?.startsWith('Apple') ? 150 : // Safari will open 256, but it won't reliably keep them all open at once.
33
- globalThis.navigator.userAgent?.includes('Firefox') ? 150 : // I can sometimes get maybe a dozen more, but not with refresh.
33
+ globalThis.navigator.userAgent?.includes('Firefox') ? 150 : // 256 on an M5 chip. On an i9 MBP, I can sometimes get more than 150, but not with refresh.
34
34
  (typeof(globalThis.process) !== 'undefined') ? 249 : // NodeJS
35
35
  256;
36
36
  constructor({configuration = {iceServers: WebRTC.iceServers}, ...properties}) {
@@ -67,7 +67,7 @@ export class WebRTC {
67
67
  this.pc.ondatachannel = e => this.ondatachannel(e.channel);
68
68
  this.pc.onicecandidateerror = error => {
69
69
  const {errorCode, errorText, url, address, port} = error;
70
- console.error(errorText, {errorCode, url, address, port});
70
+ this.flog(`${errorCode}: ${errorText || '(ice failure)'} ${address}:${port} @${url}`);
71
71
  };
72
72
  this.pc.oniceconnectionstatechange = () => {
73
73
  if (!this.pc) return;
@@ -330,11 +330,11 @@ export class WebRTC {
330
330
  return;
331
331
  }
332
332
  const remote = stats.get(candidatePair.remoteCandidateId);
333
- const {protocol, candidateType} = remote;
333
+ const {protocol, candidateType, address} = remote;
334
334
  const now = Date.now();
335
335
  const statsElapsed = now - this.connectionStartTime;
336
336
  Object.assign(this, {stats, transport, candidatePair, remote, protocol, candidateType, statsTime: now, statsElapsed});
337
- if (doLogging) console.info(this.name, 'connected', protocol, candidateType, (statsElapsed/1e3).toFixed(1));
337
+ if (doLogging) console.info(this.name, 'connected', protocol, candidateType, address, (statsElapsed/1e3).toFixed(1));
338
338
  }
339
339
 
340
340
  static getPublicIP(stunServer = "stun:stun.l.google.com:19302") { // Promise external/WAN/public IP addresses for this device.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yz-social/webrtc",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "Streamlined portable webrtc management of p2p and client2server.",
5
5
  "keywords": [
6
6
  "webrtc",