teleportxr 1.0.49 → 1.0.51

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
@@ -54,7 +54,15 @@ class Client {
54
54
  this.currentOriginState=new OriginState();
55
55
  this.currentLightingState=new LightingState();
56
56
  this.next_ack_id=BigInt(1);
57
+ this.clientStartMs=Date.now();
58
+ this.webRtcConnectedAtMs=0;
57
59
  }
60
+ elapsedMsSinceStart(){
61
+ return Date.now()-this.clientStartMs;
62
+ }
63
+ elapsedMsSinceConnected(){
64
+ return this.webRtcConnectedAtMs?Date.now()-this.webRtcConnectedAtMs:-1;
65
+ }
58
66
  tick(timestamp){
59
67
  this.geometryService.GetNodesToSend();
60
68
  }
@@ -62,11 +70,16 @@ class Client {
62
70
  {
63
71
  //this.webRtcConnection=wrtcConn;
64
72
  // This should have come from our own existing webRtcConnection and nowhere else.
65
- console.log("Connection state is "+newState.toString());
73
+ console.log("[T+"+this.elapsedMsSinceStart()+"ms] Connection state is "+newState.toString());
66
74
  if(newState=="connected")
67
75
  {
68
76
  //this.webRtcConnection.sendGeometry("test");
69
77
  this.webRtcConnected=true;
78
+ this.webRtcConnectedAtMs=Date.now();
79
+ console.log("[T+"+this.elapsedMsSinceStart()+"ms] WebRTC CONNECTED for client "+this.clientID+" — triggering immediate UpdateStreaming tick.");
80
+ // Kick an immediate tick so SetOriginNode and the first resource batch are
81
+ // sent without waiting for the next periodic interval (up to 1000 ms away).
82
+ setImmediate(this.UpdateStreaming.bind(this));
70
83
  }
71
84
  else
72
85
  {
@@ -147,6 +160,8 @@ class Client {
147
160
  // In Start() we send the SetupCommand.
148
161
  Start()
149
162
  {
163
+ this.clientStartMs=Date.now();
164
+ console.log("[T+0ms] Client.Start() — sending SetupCommand for client "+this.clientID);
150
165
  this.setupCommand=new command.SetupCommand();
151
166
  this.clientDynamicLighting=new core.ClientDynamicLighting();
152
167
  // Session is (re)starting; the client has zero state, so retract any
@@ -224,6 +239,7 @@ class Client {
224
239
  // We call StartStreaming once the SetupCommand has been acknowledged.
225
240
  StartStreaming()
226
241
  {
242
+ console.log("[T+"+this.elapsedMsSinceStart()+"ms] Client.StartStreaming() — creating WebRTC connection for client "+this.clientID);
227
243
  this.webRtcConnectionManager=WebRtcConnectionManager.getInstance();
228
244
  // We make sure WebRTC has a connection for this client.
229
245
  this.webRtcConnection = this.webRtcConnectionManager.createConnection(
@@ -304,6 +320,7 @@ class Client {
304
320
  return;
305
321
  if(!this.webRtcConnected)
306
322
  return;
323
+ console.log("[T+"+this.elapsedMsSinceStart()+"ms, conn+"+this.elapsedMsSinceConnected()+"ms] UpdateStreaming tick for client "+this.clientID);
307
324
  var timestamp=core.getTimestampUs();
308
325
  // Establish which nodes the client should have, and their resources.
309
326
  // Then: which resources we think it does not yet have. Send those.
@@ -393,7 +410,7 @@ class Client {
393
410
  this.currentOriginState.acknowledged=false;
394
411
  this.currentOriginState.serverTimeSentUs=core.getTimestampUs();
395
412
  console.log("\n===== NODE SERVER SENDING SETORIGINCOMMAND =====");
396
- console.log("Sending SetOriginNodeCommand with origin uid "+setp.uint64_originNodeUid+" and ackId "+setp.uint64_ackId);
413
+ console.log("[T+"+this.elapsedMsSinceStart()+"ms, conn+"+this.elapsedMsSinceConnected()+"ms] Sending SetOriginNodeCommand with origin uid "+setp.uint64_originNodeUid+" and ackId "+setp.uint64_ackId);
397
414
  console.log("\n===== END SETORIGINCOMMAND =====");
398
415
  this.SendCommand(setp);
399
416
  }
@@ -22,7 +22,7 @@ class ClientManager
22
22
  this.geometryIntervalId = setInterval(_.bind( function() {
23
23
  //console.log("Streaming Update at "+core.getTimestampUs()/1000000.0);
24
24
  this.UpdateStreaming();
25
- },this), 5000);
25
+ },this), 1000);
26
26
  }
27
27
  StopStreaming(){
28
28
  if(this.geometryIntervalId!=0)
@@ -372,7 +372,7 @@ class WebRtcConnection extends EventEmitter
372
372
  this.videoDataChannel = this.createDataChannel("video",20);
373
373
  this.tagDataChannel = this.createDataChannel("video_tags",40);
374
374
  this.audioToClientDataChannel = this.createDataChannel("audio_server_to_client",60);
375
- this.geometryDataChannel = this.createDataChannel("geometry",80);
375
+ this.geometryDataChannel = this.createDataChannel("geometry_unframed",80);
376
376
  this.reliableDataChannel = this.createDataChannel("reliable",100);
377
377
  this.unreliableDataChannel = this.createDataChannel("unreliable",120,false);
378
378
 
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.49",
18
+ "version": "1.0.51",
19
19
  "repository": {
20
20
  "type": "git",
21
21
  "url": "git+https://github.com/simul/teleport-nodejs.git"