@annals/agent-mesh 0.18.2 → 0.18.3
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/dist/index.js +45 -36
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -367,19 +367,22 @@ var FileSender = class {
|
|
|
367
367
|
});
|
|
368
368
|
});
|
|
369
369
|
}
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
this.peer.
|
|
380
|
-
|
|
381
|
-
|
|
370
|
+
try {
|
|
371
|
+
if (signal.signal_type === "offer" || signal.signal_type === "answer") {
|
|
372
|
+
this.peer.setRemoteDescription(signal.payload, signal.signal_type);
|
|
373
|
+
for (const c of this.pendingCandidates) {
|
|
374
|
+
this.peer.addRemoteCandidate(c.candidate, c.mid);
|
|
375
|
+
}
|
|
376
|
+
this.pendingCandidates = [];
|
|
377
|
+
} else if (signal.signal_type === "candidate") {
|
|
378
|
+
const { candidate, mid } = JSON.parse(signal.payload);
|
|
379
|
+
if (this.peer.remoteDescription()) {
|
|
380
|
+
this.peer.addRemoteCandidate(candidate, mid);
|
|
381
|
+
} else {
|
|
382
|
+
this.pendingCandidates.push({ candidate, mid });
|
|
383
|
+
}
|
|
382
384
|
}
|
|
385
|
+
} catch {
|
|
383
386
|
}
|
|
384
387
|
}
|
|
385
388
|
async sendZip(dc) {
|
|
@@ -469,19 +472,22 @@ var FileReceiver = class {
|
|
|
469
472
|
}
|
|
470
473
|
async handleSignal(signal) {
|
|
471
474
|
if (!this.peer || this.closed) return;
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
this.peer.
|
|
482
|
-
|
|
483
|
-
|
|
475
|
+
try {
|
|
476
|
+
if (signal.signal_type === "answer" || signal.signal_type === "offer") {
|
|
477
|
+
this.peer.setRemoteDescription(signal.payload, signal.signal_type);
|
|
478
|
+
for (const c of this.pendingCandidates) {
|
|
479
|
+
this.peer.addRemoteCandidate(c.candidate, c.mid);
|
|
480
|
+
}
|
|
481
|
+
this.pendingCandidates = [];
|
|
482
|
+
} else if (signal.signal_type === "candidate") {
|
|
483
|
+
const { candidate, mid } = JSON.parse(signal.payload);
|
|
484
|
+
if (this.peer.remoteDescription()) {
|
|
485
|
+
this.peer.addRemoteCandidate(candidate, mid);
|
|
486
|
+
} else {
|
|
487
|
+
this.pendingCandidates.push({ candidate, mid });
|
|
488
|
+
}
|
|
484
489
|
}
|
|
490
|
+
} catch {
|
|
485
491
|
}
|
|
486
492
|
}
|
|
487
493
|
waitForCompletion(timeoutMs = CONNECT_TIMEOUT_MS) {
|
|
@@ -684,19 +690,22 @@ var FileUploadSender = class {
|
|
|
684
690
|
}
|
|
685
691
|
async handleSignal(signal) {
|
|
686
692
|
if (!this.peer || this.closed) return;
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
this.peer.
|
|
697
|
-
|
|
698
|
-
|
|
693
|
+
try {
|
|
694
|
+
if (signal.signal_type === "answer" || signal.signal_type === "offer") {
|
|
695
|
+
this.peer.setRemoteDescription(signal.payload, signal.signal_type);
|
|
696
|
+
for (const c of this.pendingCandidates) {
|
|
697
|
+
this.peer.addRemoteCandidate(c.candidate, c.mid);
|
|
698
|
+
}
|
|
699
|
+
this.pendingCandidates = [];
|
|
700
|
+
} else if (signal.signal_type === "candidate") {
|
|
701
|
+
const { candidate, mid } = JSON.parse(signal.payload);
|
|
702
|
+
if (this.peer.remoteDescription()) {
|
|
703
|
+
this.peer.addRemoteCandidate(candidate, mid);
|
|
704
|
+
} else {
|
|
705
|
+
this.pendingCandidates.push({ candidate, mid });
|
|
706
|
+
}
|
|
699
707
|
}
|
|
708
|
+
} catch {
|
|
700
709
|
}
|
|
701
710
|
}
|
|
702
711
|
waitForCompletion(timeoutMs = 3e4) {
|