teleportxr 1.0.8 → 1.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/client/client.js CHANGED
@@ -111,6 +111,7 @@ class Client {
111
111
  Start()
112
112
  {
113
113
  this.setupCommand=new command.SetupCommand();
114
+ this.setupCommand.float32_draw_distance=10.0;
114
115
  if(this.scene)
115
116
  {
116
117
  if(this.scene.backgroundTexturePath&&this.scene.backgroundTexturePath!="")
@@ -130,7 +131,7 @@ class Client {
130
131
  {
131
132
  this.webRtcConnectionManager=WebRtcConnectionManager.getInstance();
132
133
  // We make sure WebRTC has a connection for this client.
133
- this.webRtcConnection = this. webRtcConnectionManager.createConnection(
134
+ this.webRtcConnection = this.webRtcConnectionManager.createConnection(
134
135
  this.clientID
135
136
  ,this.streamingConnectionStateChanged.bind(this)
136
137
  ,this.receivedMessageReliable.bind(this)
@@ -47,7 +47,7 @@ class ClientManager
47
47
  error("Failed to create a root node for client "+clientID);
48
48
  return null;
49
49
  }
50
- var sigCli=signaling.signalingClients[clientID];
50
+ var sigCli=signaling.signalingClients.get(clientID);
51
51
  var sigSend=sigCli.sendToClient.bind(sigCli);
52
52
  var c=new client.Client(clientID,sigSend);
53
53
  c.setOrigin(origin_uid);
@@ -97,7 +97,7 @@ class ClientManager
97
97
  writeState() {
98
98
  var content="<table><tr><th>Client Id</th><th>IP Address</th><th>Signalling State</th></tr>";
99
99
  for (let [cl_id,cl] of this.clients) {
100
- var sigCli=signaling.signalingClients[cl_id];
100
+ var sigCli=signaling.signalingClients.get(cl_id);
101
101
  content+="\n<tr><td>"+cl_id+"</td> <td>" + sigCli.ip + "</td> <td>" + sigCli.signalingState + "</td></tr>";
102
102
  };
103
103
  content+="\n</table>";
@@ -27,30 +27,30 @@ class TrackedResource
27
27
  this.acknowledged=new bit.BitSet(); // Whether the client acknowledged receiving the resource.
28
28
  }
29
29
  IsNeededByClient(clientID) {
30
- return this.clientNeeds.get[clientIDToIndex[clientID]];
30
+ return this.clientNeeds.get(clientIDToIndex.get(clientID));
31
31
  }
32
32
  WasSentToClient(clientID) {
33
- return this.sent.get[clientIDToIndex[clientID]];
33
+ return this.sent.get(clientIDToIndex.get(clientID));
34
34
  }
35
35
  WasAcknowledgedByClient(clientID) {
36
- return this.acknowledged.get(clientIDToIndex[clientID]);
36
+ return this.acknowledged.get(clientIDToIndex.get(clientID));
37
37
  }
38
38
  GetTimeSent(clientID) {
39
- return this.sent_server_time_us[clientID];
39
+ return this.sent_server_time_us.get(clientID);
40
40
  }
41
41
  Sent(clientID,timestamp) {
42
- this.sent.set(clientIDToIndex[clientID],true);
43
- this.acknowledged.set(clientIDToIndex[clientID],false);
42
+ this.sent.set(clientIDToIndex.get(clientID),true);
43
+ this.acknowledged.set(clientIDToIndex.get(clientID),false);
44
44
  this.sent_server_time_us.set(clientID,timestamp);
45
45
  }
46
46
  AcknowledgeBy(clientID) {
47
- this.acknowledged.set(clientIDToIndex[clientID],true);
47
+ this.acknowledged.set(clientIDToIndex.get(clientID),true);
48
48
  // erase timestamp?
49
49
  this.sent_server_time_us.delete(clientID);
50
50
  }
51
51
  Timeout(clientID) {
52
- this.sent.set(clientIDToIndex[clientID],false);
53
- this.acknowledged.set(clientIDToIndex[clientID],false);
52
+ this.sent.set(clientIDToIndex.get(clientID),false);
53
+ this.acknowledged.set(clientIDToIndex.get(clientID),false);
54
54
  this.sent_server_time_us.clear(clientID);
55
55
  }
56
56
  };
@@ -92,6 +92,8 @@ class GeometryService
92
92
  this.streamedFontAtlases=new Map();
93
93
 
94
94
  this.backgroundTextureUid=0;
95
+ // ten seconds for timeout. Tweak this.
96
+ this.timeout_us=10000000;
95
97
  }
96
98
  SetScene(sc) {
97
99
  this.scene=sc;
@@ -299,8 +301,6 @@ class GeometryService
299
301
 
300
302
  UpdateNodesToStream()
301
303
  {
302
- // ten seconds for timeout. Tweak this.
303
- const timeout_us=10000000;
304
304
  // The set of ALL the nodes of sufficient priority that the client NEEDS is streamedNodes.
305
305
  for(let uid of this.nodesToStreamEventually)
306
306
  {
@@ -343,7 +343,7 @@ class GeometryService
343
343
  {
344
344
  var timeSentUs=res.GetTimeSent(this.clientID);
345
345
  // If we sent it too long ago with no acknowledgement, we can send it again.
346
- if(time_now_us-timeSentUs>timeout_us)
346
+ if(time_now_us-timeSentUs>this.timeout_us)
347
347
  {
348
348
  res.Timeout(this.clientID);
349
349
  }
@@ -376,15 +376,17 @@ class GeometryService
376
376
  var resource_uids=[];
377
377
  let time_now_us=core.getTimestampUs();
378
378
  for(const [uid, count] of this.streamedMeshes)
379
- {
379
+ {
380
380
  //is mesh streamed
381
381
  var res=GeometryService.GetOrCreateTrackedResource(uid);
382
- res.Sent(this.clientID,time_now_us);
382
+ // If it was already received we don't send it:
383
+ if(res.WasAcknowledgedByClient(this.clientID))
384
+ continue;
383
385
  if(res.WasSentToClient(this.clientID))
384
386
  {
385
387
  var timeSentUs=res.GetTimeSent(this.clientID);
386
388
  // If we sent it too long ago with no acknowledgement, we can send it again.
387
- if(time_now_us-timeSentUs>timeout_us)
389
+ if(time_now_us-timeSentUs>this.timeout_us)
388
390
  {
389
391
  res.Timeout(this.clientID);
390
392
  }
@@ -393,6 +395,7 @@ class GeometryService
393
395
  {
394
396
  // if it hasn't been sent at all to our client, we add its resources.
395
397
  resource_uids.push(uid);
398
+ res.Sent(this.clientID,time_now_us);
396
399
  }
397
400
  };
398
401
  return resource_uids;
@@ -6,7 +6,7 @@ const DefaultRTCPeerConnection = require('@roamhq/wrtc').RTCPeerConnection;
6
6
 
7
7
  const TIME_TO_CONNECTED = 10000;
8
8
  const TIME_TO_HOST_CANDIDATES = 3000; // NOTE: Too long.
9
- const TIME_TO_RECONNECTED = 10000;
9
+ const TIME_TO_RECONNECTED = 1000;
10
10
 
11
11
  function EVEN_ID(id) {
12
12
  return (id-(id%2))
@@ -22,7 +22,7 @@ class WebRtcConnection extends EventEmitter
22
22
  this.id = id;
23
23
  this.state = 'open';
24
24
 
25
- options = {
25
+ this.options = {
26
26
  RTCPeerConnection: DefaultRTCPeerConnection,
27
27
  clearTimeout,
28
28
  setTimeout,
@@ -38,75 +38,110 @@ class WebRtcConnection extends EventEmitter
38
38
  timeToReconnected
39
39
  } = options;
40
40
 
41
- this.connectionStateChanged =options.connectionStateChanged;
41
+ this.connectionStateChanged =options.connectionStateChanged;
42
42
  this.messageReceivedReliableCb =options.messageReceivedReliable;
43
43
  this.messageReceivedUnreliableCb =options.messageReceivedUnreliable;
44
44
 
45
45
  this.sendConfigMessage =options.sendConfigMessage;
46
- const peerConnection =new RTCPeerConnection({ sdpSemantics: 'unified-plan'});
47
- this.pc =peerConnection;
46
+
47
+
48
+ Object.defineProperties(this, {
49
+ iceConnectionState: {
50
+ get ()
51
+ {
52
+ return this.peerConnection.iceConnectionState;
53
+ }
54
+ },
55
+ localDescription: {
56
+ get ()
57
+ {
58
+ return descriptionToJSON(this.peerConnection.localDescription, true);
59
+ }
60
+ },
61
+ remoteDescription: {
62
+ get ()
63
+ {
64
+ return descriptionToJSON(this.peerConnection.remoteDescription);
65
+ }
66
+ },
67
+ signalingState: {
68
+ get ()
69
+ {
70
+ return this.peerConnection.signalingState;
71
+ }
72
+ }
73
+ });
74
+ this.reconnect();
75
+ }
76
+
77
+ reconnect()
78
+ {
79
+ this.peerConnection =new DefaultRTCPeerConnection({ sdpSemantics: 'unified-plan'});
48
80
 
49
- this.beforeOffer(peerConnection);
81
+ this.beforeOffer();
50
82
 
51
- let connectionTimer = options.setTimeout(() =>
83
+ let connectionTimer = this.options.setTimeout(() =>
52
84
  {
53
- if (peerConnection.iceConnectionState !== 'connected'
54
- && peerConnection.iceConnectionState !== 'completed')
85
+ if (this.peerConnection.iceConnectionState !== 'connected'
86
+ && this.peerConnection.iceConnectionState !== 'completed')
55
87
  {
56
88
  this.close();
57
89
  }
58
- }, timeToConnected);
90
+ }, this.options.timeToConnected);
59
91
 
60
92
  let reconnectionTimer = null;
61
93
 
62
94
  const onIceConnectionStateChange = () =>
63
95
  {
64
- console.log("ICE state changed to: "+peerConnection.iceConnectionState);
65
- if (peerConnection.iceConnectionState === 'connected'
66
- || peerConnection.iceConnectionState === 'completed')
96
+ console.log("ICE state changed to: "+this.peerConnection.iceConnectionState);
97
+ if (this.peerConnection.iceConnectionState === 'connected'
98
+ || this.peerConnection.iceConnectionState === 'completed')
67
99
  {
68
100
  if (connectionTimer)
69
101
  {
70
- options.clearTimeout(connectionTimer);
102
+ this.options.clearTimeout(connectionTimer);
71
103
  connectionTimer = null;
72
104
  }
73
- options.clearTimeout(reconnectionTimer);
105
+ this.options.clearTimeout(reconnectionTimer);
74
106
  reconnectionTimer = null;
75
- } else if (peerConnection.iceConnectionState === 'disconnected'
76
- || peerConnection.iceConnectionState === 'failed')
107
+ } else if (this.peerConnection.iceConnectionState === 'disconnected'
108
+ || this.peerConnection.iceConnectionState === 'failed')
77
109
  {
110
+ this.peerConnection.restartIce();
111
+ console.log("restartIce()");
78
112
  if (!connectionTimer && !reconnectionTimer)
79
113
  {
80
114
  const self = this;
81
- reconnectionTimer = options.setTimeout(() =>
115
+ reconnectionTimer = this.options.setTimeout(() =>
82
116
  {
83
- self.close();
84
- }, timeToReconnected);
117
+ this.reconnect();
118
+ this.doOffer();
119
+ }, this.options.timeToReconnected);
85
120
  }
86
121
  }
87
122
  };
88
123
  const onIceGatheringStateChange = () =>
89
124
  {
90
- console.log("ICE gathering state changed to: "+peerConnection.iceGatheringState);
125
+ console.log("ICE gathering state changed to: "+this.peerConnection.iceGatheringState);
91
126
  };
92
127
 
93
- peerConnection.addEventListener('iceconnectionstatechange', onIceConnectionStateChange);
94
- peerConnection.addEventListener('icegatheringstatechange', onIceGatheringStateChange);
128
+ this.peerConnection.addEventListener('iceconnectionstatechange', onIceConnectionStateChange);
129
+ this.peerConnection.addEventListener('icegatheringstatechange', onIceGatheringStateChange);
95
130
 
96
131
 
97
132
  const onConnectionStateChange = () =>
98
- {
99
- console.log("Connection State changed to: "+peerConnection.connectionState.toString());
100
- this.connectionStateChanged(this,peerConnection.connectionState);
133
+ {
134
+ console.log("Connection State changed to: "+this.peerConnection.connectionState.toString());
135
+ this.connectionStateChanged(this,this.peerConnection.connectionState);
101
136
  }
102
- peerConnection.addEventListener("connectionstatechange", onConnectionStateChange);
137
+ this.peerConnection.addEventListener("connectionstatechange", onConnectionStateChange);
103
138
 
104
139
  this.onIceCandidate= ({ candidate })=>
105
140
  {
106
141
  if (!candidate)
107
142
  {
108
- options.clearTimeout(this.timeout);
109
- //peerConnection.removeEventListener('icecandidate', this.onIceCandidate);
143
+ this.options.clearTimeout(this.timeout);
144
+ //this.peerConnection.removeEventListener('icecandidate', this.onIceCandidate);
110
145
  this.deferred.resolve();
111
146
  return;
112
147
  }
@@ -138,7 +173,6 @@ class WebRtcConnection extends EventEmitter
138
173
  this.deferred.reject(new Error('Timed out waiting for host candidates'));
139
174
  }, timeToHostCandidates);
140
175
 
141
-
142
176
  peerConnection.addEventListener('icecandidate', this.onIceCandidate);
143
177
 
144
178
  await this.deferred.promise;
@@ -148,11 +182,11 @@ class WebRtcConnection extends EventEmitter
148
182
  {
149
183
  try
150
184
  {
151
- const offer = await peerConnection.createOffer();
152
- await peerConnection.setLocalDescription(offer);
185
+ const offer = await this.peerConnection.createOffer();
186
+ await this.peerConnection.setLocalDescription(offer);
153
187
  var message = '{"teleport-signal-type":"offer","sdp":"'+offer.sdp+'"}'; //
154
188
  this.sendConfigMessage(this.id,message);
155
- await this.waitUntilIceGatheringStateComplete(peerConnection, options);
189
+ await this.waitUntilIceGatheringStateComplete(this.peerConnection, this.options);
156
190
  } catch (error)
157
191
  {
158
192
  console.error(error.toString());
@@ -174,32 +208,31 @@ class WebRtcConnection extends EventEmitter
174
208
  var sessionDescription=new wrtc.RTCSessionDescription();
175
209
  sessionDescription.sdp=answer;
176
210
  sessionDescription.type="answer";
177
- await peerConnection.setRemoteDescription( sessionDescription);
211
+ await this.peerConnection.setRemoteDescription( sessionDescription);
178
212
  };
179
213
  this.applyRemoteCandidate = async(candidate_txt,mid,mlineindex)=>
180
214
  {
181
215
  console.log("received remote candidate.");
182
- peerConnection.addIceCandidate(new wrtc.RTCIceCandidate({
216
+ this.peerConnection.addIceCandidate(new wrtc.RTCIceCandidate({
183
217
  candidate: candidate_txt,
184
218
  sdpMLineIndex: mlineindex,
185
219
  sdpMid: mid
186
220
  }));
187
221
  };
188
-
189
222
  this.close = () =>
190
223
  {
191
- peerConnection.removeEventListener('iceconnectionstatechange', onIceConnectionStateChange);
224
+ this.peerConnection.removeEventListener('iceconnectionstatechange', onIceConnectionStateChange);
192
225
  if (connectionTimer)
193
226
  {
194
- options.clearTimeout(connectionTimer);
227
+ this.options.clearTimeout(connectionTimer);
195
228
  connectionTimer = null;
196
229
  }
197
230
  if (reconnectionTimer)
198
231
  {
199
- options.clearTimeout(reconnectionTimer);
232
+ this.options.clearTimeout(reconnectionTimer);
200
233
  reconnectionTimer = null;
201
234
  }
202
- peerConnection.close();
235
+ this.peerConnection.close();
203
236
  this.state = 'closed';
204
237
  this.emit('closed');
205
238
  };
@@ -215,33 +248,6 @@ class WebRtcConnection extends EventEmitter
215
248
  signalingState: this.signalingState
216
249
  };
217
250
  };
218
-
219
- Object.defineProperties(this, {
220
- iceConnectionState: {
221
- get ()
222
- {
223
- return peerConnection.iceConnectionState;
224
- }
225
- },
226
- localDescription: {
227
- get ()
228
- {
229
- return descriptionToJSON(peerConnection.localDescription, true);
230
- }
231
- },
232
- remoteDescription: {
233
- get ()
234
- {
235
- return descriptionToJSON(peerConnection.remoteDescription);
236
- }
237
- },
238
- signalingState: {
239
- get ()
240
- {
241
- return peerConnection.signalingState;
242
- }
243
- }
244
- });
245
251
  }
246
252
  sendGeometry(buffer) {
247
253
  try {
@@ -251,7 +257,7 @@ class WebRtcConnection extends EventEmitter
251
257
  console.error('datachannel.sendGeometry exception: '+exception.message);
252
258
  }
253
259
  }
254
- beforeOffer(peerConnection) {
260
+ beforeOffer() {
255
261
 
256
262
  this.videoDataChannel = this.createDataChannel("video",20);
257
263
  this.tagDataChannel = this.createDataChannel("video_tags",40);
@@ -259,7 +265,7 @@ class WebRtcConnection extends EventEmitter
259
265
  this.geometryDataChannel = this.createDataChannel("geometry_unframed",80);
260
266
  this.reliableDataChannel = this.createDataChannel("reliable",100);
261
267
  this.unreliableDataChannel = this.createDataChannel("unreliable",120,false);
262
- // this.dataChannel = peerConnection.createDataChannel('ping-pong',{id:2050});
268
+ // this.dataChannel = this.peerConnection.createDataChannel('ping-pong',{id:2050});
263
269
 
264
270
  function onMessage({ data }) {
265
271
  if (data === 'ping') {
@@ -270,9 +276,9 @@ class WebRtcConnection extends EventEmitter
270
276
  // NOTE(mroberts): This is a hack so that we can get a callback when the
271
277
  // RTCPeerConnection is closed. In the future, we can subscribe to
272
278
  // "connectionstatechange" events.
273
- const { close } = peerConnection;
279
+ const { close } = this.peerConnection;
274
280
  var self=this;
275
- peerConnection.close = function() {
281
+ this.peerConnection.close = function() {
276
282
  //self.dataChannel.removeEventListener('message', onMessage);
277
283
  return close.apply(this, arguments);
278
284
  };
@@ -304,7 +310,7 @@ class WebRtcConnection extends EventEmitter
304
310
  //See https://web.dev/articles/webrtc-datachannels. Can only use id if negotiated=true.
305
311
  const dataChannelOptions={ordered:reliable,maxRetransmits:reliable?10000:0,id:id};
306
312
 
307
- var dc=this.pc.createDataChannel(label,dataChannelOptions);
313
+ var dc=this.peerConnection.createDataChannel(label,dataChannelOptions);
308
314
 
309
315
  dc.onmessage = this.receiveMessage.bind(this,id);
310
316
 
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.8",
16
+ "version": "1.0.10",
17
17
  "repository": {
18
18
  "type": "git",
19
19
  "url": "git+https://github.com/simul/teleport-nodejs.git"
package/scene/scene.js CHANGED
@@ -60,6 +60,7 @@ class Scene {
60
60
  if (pose) {
61
61
  n.pose.position = { x: pose.position[0], y: pose.position[1], z: pose.position[2] };
62
62
  n.pose.orientation = { x: pose.orientation[0], y: pose.orientation[1], z: pose.orientation[2], w: pose.orientation[3] };
63
+ n.pose.scale = { x: pose.scale[0], y: pose.scale[1], z: pose.scale[2] };
63
64
  }
64
65
  const components = sub_obj["components"];
65
66
  if (components) {
package/signaling.js CHANGED
@@ -60,7 +60,7 @@ function sendResponseToClient(clientID) {
60
60
  if (!signalingClients.has(clientID)) {
61
61
  console.log("No client "+clientID+" found.");
62
62
  } else {
63
- var signalingClient=signalingClients[clientID];
63
+ var signalingClient=signalingClients.get(clientID);
64
64
  // First, we send the WebSockets signaling response.
65
65
  var txt =
66
66
  '{"teleport-signal-type":"request-response","content":{"clientID": ' +
@@ -96,7 +96,7 @@ function processInitialRequest(clientID, signalingClient, content) {
96
96
  }
97
97
  // identifies as a previous client. Discard the new client ID.
98
98
  //TODO: we're taking the client's word for it that it is clientID. Some kind of token/hash?
99
- signalingClients[clientID] = signalingClient;
99
+ signalingClients.set(clientID,signalingClient);
100
100
  if (j_clientID != clientID) {
101
101
  console.log(
102
102
  "info: Remapped from " + clientID + " to " + j_clientID
@@ -106,36 +106,39 @@ function processInitialRequest(clientID, signalingClient, content) {
106
106
  );
107
107
 
108
108
  if (signalingClients.has(clientID)) {
109
- signalingClients[clientID] = null;
109
+ signalingClients.delete(clientID);
110
110
  clientUids.erase(clientID);
111
111
  }
112
112
  clientID = j_clientID;
113
113
  }
114
114
  }
115
115
  var ipAddr = signalingClient.ip_addr_port;
116
+ if (desiredIP.length != 0 && !ipAddr.contains(desiredIP))
117
+ return;
116
118
  // Skip clients we have already added.
117
119
  if (signalingClient.signalingState == SignalingState.START)
118
120
  signalingClient.ChangeSignalingState(SignalingState.REQUESTED);
121
+ //Ignore connections from clients with the wrong IP, if a desired IP has been set.
119
122
  // if signalingState is START, we should not have a client...
120
- if (signalingClient.client != null) {
123
+ if (signalingClient.signalingState==SignalingState.ACCEPTED||signalingClient.signalingState==SignalingState.STREAMING)
124
+ {
121
125
  // ok, we've received a connection request from a client that WE think we already have.
122
126
  // Apparently the CLIENT thinks they've disconnected.
123
127
  // The client might, as far as we know, have lost the information it needs to continue the connection.
124
128
  // Therefore we should resend everything required.
125
- signalingClient.ChangeSignalingState(SignalingState.STREAMING);
129
+ //signalingClient.ChangeSignalingState(SignalingState.STREAMING);
126
130
  console.log(
127
131
  "Warning: Client " +
128
132
  clientID +
129
133
  " reconnected, but we didn't know we'd lost them."
130
134
  );
131
135
  // It may be just that the connection request was already in flight when we accepted its predecessor.
132
- sendResponseToClient(clientID);
136
+ //sendResponseToClient(clientID);
137
+ startStreaming(signalingClient);
133
138
  return;
134
139
  }
135
- if (signalingClient.signalingState != SignalingState.REQUESTED)
136
- return;
137
- //Ignore connections from clients with the wrong IP, if a desired IP has been set.
138
- if (desiredIP.length == 0 || ipAddr.contains(desiredIP)) {
140
+ if (signalingClient.signalingState==SignalingState.REQUESTED)
141
+ {
139
142
  startStreaming(signalingClient);
140
143
  }
141
144
  }
@@ -252,7 +255,7 @@ exports.sendConfigMessage = function (clientID, msg) {
252
255
 
253
256
  if (signalingClients.has(clientID)) {
254
257
  console.log("sendConfigMessage to "+clientID+": "+msg);
255
- signalingClients[clientID].ws.send(escapedStr);
258
+ signalingClients.get(clientID).ws.send(escapedStr);
256
259
  } else {
257
260
  console.log(
258
261
  "sendConfigMessage with clientID " +
package/server.js DELETED
@@ -1,35 +0,0 @@
1
- 'use strict';
2
-
3
- const WebRtcConnectionManager = require('./connections/webrtcconnectionmanager');
4
- const cm = require('./client/client_manager.js');
5
-
6
- const signaling=require("./signaling.js");
7
- const scene=require("./scene/scene.js");
8
-
9
- var sc=new scene.Scene();
10
-
11
- const fs = require('fs');
12
- const path = require('path');
13
-
14
- const assetsPath = path.join(__dirname,'assets');
15
-
16
- sc.Load(path.join(assetsPath,'scene.json'));
17
-
18
- // This is our app's callback for when a new client is to be created.
19
- // It must return the origin uid for the client.
20
- function createNewClient(clientID) {
21
- var origin_uid=sc.CreateNode();
22
- return origin_uid;
23
- }
24
-
25
- // This will be called AFTER a client has been created, so we can access it from the clientManager.
26
- function onClientPostCreate(clientID) {
27
- var client=cm.getInstance().GetClient(clientID);
28
- client.SetScene(sc);
29
- }
30
-
31
- const webRtcConnectionManager = WebRtcConnectionManager.getInstance();
32
- webRtcConnectionManager.SetSendConfigMessage(signaling.sendConfigMessage);
33
- cm.getInstance().SetNewClientCallback(createNewClient);
34
- cm.getInstance().SetClientPostCreationCallback(onClientPostCreate);
35
- signaling.init(webRtcConnectionManager,cm.getInstance().newClient.bind(cm.getInstance()));