teleportxr 1.0.36 → 1.0.38
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 +19 -2
- package/connections/webrtcconnection.js +12 -4
- package/package.json +1 -1
package/client/client.js
CHANGED
|
@@ -143,9 +143,26 @@ class Client {
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
// Log the setup command for debugging
|
|
146
|
+
// Log the setup command for debugging - in the CORRECT C++ struct byte order
|
|
147
147
|
console.log("\n===== NODE SERVER SENDING SETUPCOMMAND =====");
|
|
148
|
-
|
|
148
|
+
const logObj = {
|
|
149
|
+
CommandPayloadType: this.setupCommand.CommandPayloadType_commandPayloadType,
|
|
150
|
+
debug_stream: this.setupCommand.uint32_debug_stream,
|
|
151
|
+
debug_network_packets: this.setupCommand.uint32_debug_network_packets,
|
|
152
|
+
requiredLatencyMs: this.setupCommand.int32_requiredLatencyMs,
|
|
153
|
+
idle_connection_timeout: this.setupCommand.uint32_idle_connection_timeout,
|
|
154
|
+
session_id: this.setupCommand.uint64_session_id,
|
|
155
|
+
video_config: this.setupCommand.VideoConfig_video_config,
|
|
156
|
+
draw_distance: this.setupCommand.float32_draw_distance,
|
|
157
|
+
axesStandard: this.setupCommand.AxesStandard_axesStandard,
|
|
158
|
+
audio_input_enabled: this.setupCommand.uint8_audio_input_enabled,
|
|
159
|
+
using_ssl: this.setupCommand.bool_using_ssl,
|
|
160
|
+
startTimestamp_utc_unix_us: this.setupCommand.int64_startTimestamp_utc_unix_us,
|
|
161
|
+
backgroundMode: this.setupCommand.BackgroundMode_backgroundMode,
|
|
162
|
+
backgroundColour: this.setupCommand.vec4_backgroundColour,
|
|
163
|
+
backgroundTexture: this.setupCommand.uid_backgroundTexture
|
|
164
|
+
};
|
|
165
|
+
console.log(JSON.stringify(logObj, (key, value) => {
|
|
149
166
|
if (typeof value === 'bigint') {
|
|
150
167
|
return value.toString();
|
|
151
168
|
}
|
|
@@ -183,15 +183,23 @@ class WebRtcConnection extends EventEmitter
|
|
|
183
183
|
|
|
184
184
|
this.doOffer = async () =>
|
|
185
185
|
{
|
|
186
|
+
// Capture the peerConnection at entry; if it gets swapped (reconnect)
|
|
187
|
+
// or nulled (close) during an await, abort silently rather than
|
|
188
|
+
// throwing on a stale reference and double-closing.
|
|
189
|
+
const pc = this.peerConnection;
|
|
186
190
|
try
|
|
187
|
-
{
|
|
188
|
-
const offer = await
|
|
189
|
-
|
|
191
|
+
{
|
|
192
|
+
const offer = await pc.createOffer();
|
|
193
|
+
if (this.peerConnection !== pc) return;
|
|
194
|
+
await pc.setLocalDescription(offer);
|
|
195
|
+
if (this.peerConnection !== pc) return;
|
|
190
196
|
var message = '{"teleport-signal-type":"offer","sdp":"'+offer.sdp+'"}'; //
|
|
191
197
|
this.sendConfigMessage(this.id,message);
|
|
192
|
-
await this.waitUntilIceGatheringStateComplete(
|
|
198
|
+
await this.waitUntilIceGatheringStateComplete(pc, this.options);
|
|
193
199
|
} catch (error)
|
|
194
200
|
{
|
|
201
|
+
if (this.peerConnection !== pc || this.state === 'closed')
|
|
202
|
+
return;
|
|
195
203
|
console.error("doOffer error: "+error.toString());
|
|
196
204
|
this.close();
|
|
197
205
|
console.log("doOffer close");
|
package/package.json
CHANGED