teleportxr 1.0.27 → 1.0.28

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.
@@ -21,9 +21,22 @@ class WebRtcConnection extends EventEmitter
21
21
  const defaultIceServers = [
22
22
  { urls: "stun:stun.l.google.com:19302" }
23
23
  ];
24
- this.iceServers = (options && Array.isArray(options.iceServers) && options.iceServers.length)
24
+ const requestedIceServers = (options && Array.isArray(options.iceServers) && options.iceServers.length)
25
25
  ? options.iceServers
26
26
  : defaultIceServers;
27
+ // @roamhq/wrtc rejects the entire iceServers array if any TURN entry lacks
28
+ // credentials, and TURN can't function without auth, so drop those with a warning.
29
+ this.iceServers = requestedIceServers.filter((s) =>
30
+ {
31
+ const urls = Array.isArray(s.urls) ? s.urls : [s.urls];
32
+ const isTurn = urls.some((u) => u && (u.startsWith('turn:') || u.startsWith('turns:')));
33
+ if (isTurn && (!s.username || !s.credential))
34
+ {
35
+ console.warn("WebRtcConnection: skipping TURN entry without credentials: "+JSON.stringify(s));
36
+ return false;
37
+ }
38
+ return true;
39
+ });
27
40
  this.iceTransportPolicy = (options && (options.iceTransportPolicy === 'all' || options.iceTransportPolicy === 'relay'))
28
41
  ? options.iceTransportPolicy
29
42
  : 'all';
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "name": "teleportxr",
17
17
  "description": "Teleport Spatial Server on node.js",
18
- "version": "1.0.27",
18
+ "version": "1.0.28",
19
19
  "repository": {
20
20
  "type": "git",
21
21
  "url": "git+https://github.com/simul/teleport-nodejs.git"