teleportxr 1.0.14 → 1.0.16

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/client/client.js CHANGED
@@ -231,6 +231,16 @@ class Client {
231
231
  this.geometryService.EncodedResource(uid);
232
232
  const view2 = new DataView(buffer, 0, nodeSize);
233
233
  console.log("Sending node "+uid+" "+node.name+" to Client "+this.clientID+", size: "+nodeSize+" bytes");
234
+ if(!this.webRtcConnection)
235
+ {
236
+ console.error("this.webRtcConnection is null");
237
+ return;
238
+ }
239
+ if(!this.webRtcConnection.sendGeometry)
240
+ {
241
+ console.error("this.webRtcConnection.sendGeometry is null");
242
+ return;
243
+ }
234
244
  this.webRtcConnection.sendGeometry(view2);
235
245
  }
236
246
  SendGenericResource(uid)
@@ -7,7 +7,6 @@ const DefaultRTCPeerConnection = require('@roamhq/wrtc').RTCPeerConnection;
7
7
  const TIME_TO_CONNECTED = 30000;
8
8
  const TIME_TO_HOST_CANDIDATES = 3000; // NOTE: Too long.
9
9
  const TIME_TO_RECONNECTED = 1000;
10
-
11
10
  function EVEN_ID(id) {
12
11
  return (id-(id%2))
13
12
  }
@@ -19,6 +18,15 @@ class WebRtcConnection extends EventEmitter
19
18
  constructor(id, options = {})
20
19
  {
21
20
  super();
21
+ const iceServers=[
22
+ "stun:stun.l.google.com:19302"
23
+ ];
24
+ this.iceServers = [] ;
25
+ for(const s in iceServers)
26
+ {
27
+ this.iceServers.push({ 'urls': iceServers[s] });
28
+ }
29
+ //this.iceServers=[{'urls': 'stun:stun.l.google.com:19302'}];
22
30
  this.id = id;
23
31
  this.state = 'open';
24
32
 
@@ -76,7 +84,7 @@ class WebRtcConnection extends EventEmitter
76
84
 
77
85
  reconnect()
78
86
  {
79
- this.peerConnection =new DefaultRTCPeerConnection({ sdpSemantics: 'unified-plan'});
87
+ this.peerConnection =new DefaultRTCPeerConnection({ sdpSemantics: 'unified-plan', 'iceServers': this.iceServers});
80
88
  this.beforeOffer();
81
89
  let connectionTimer = this.options.setTimeout(() =>
82
90
  {
@@ -128,7 +136,7 @@ class WebRtcConnection extends EventEmitter
128
136
  this.peerConnection.addEventListener('icegatheringstatechange', onIceGatheringStateChange);
129
137
  this.peerConnection.addEventListener("icecandidateerror", (event) => {
130
138
 
131
- console.log("ICE candidate error: "+str(event.errorCode)+" "+event.errorText+" "+event.port+" "+event.url);
139
+ console.log("ICE candidate error: "+event.errorCode+" "+event.errorText+" "+event.port+" "+event.url);
132
140
  });
133
141
 
134
142
  const onConnectionStateChange = () =>
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "name": "teleportxr",
15
15
  "description": "Teleport Spatial Server on node.js",
16
- "version": "1.0.14",
16
+ "version": "1.0.16",
17
17
  "repository": {
18
18
  "type": "git",
19
19
  "url": "git+https://github.com/simul/teleport-nodejs.git"