@xtr-dev/rondevu-client 0.18.6 → 0.18.7

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.
Files changed (2) hide show
  1. package/dist/rondevu.js +8 -21
  2. package/package.json +1 -1
package/dist/rondevu.js CHANGED
@@ -465,33 +465,20 @@ export class Rondevu extends EventEmitter {
465
465
  this.isPolling = true;
466
466
  try {
467
467
  const result = await this.api.poll(this.lastPollTimestamp);
468
- // Update timestamp FIRST to prevent re-fetching same answers if processing fails
469
- if (result.answers.length > 0) {
470
- const maxAnswerTimestamp = Math.max(...result.answers.map(a => a.answeredAt));
471
- this.lastPollTimestamp = Math.max(this.lastPollTimestamp, maxAnswerTimestamp);
472
- }
473
468
  // Process answers
474
469
  for (const answer of result.answers) {
475
470
  const activeOffer = this.activeOffers.get(answer.offerId);
476
471
  if (activeOffer && !activeOffer.answered) {
477
472
  this.debug(`Received answer for offer ${answer.offerId}`);
478
- // Mark as answered BEFORE setRemoteDescription to prevent race condition
473
+ await activeOffer.pc.setRemoteDescription({
474
+ type: 'answer',
475
+ sdp: answer.sdp
476
+ });
479
477
  activeOffer.answered = true;
480
- try {
481
- await activeOffer.pc.setRemoteDescription({
482
- type: 'answer',
483
- sdp: answer.sdp
484
- });
485
- this.emit('offer:answered', answer.offerId, answer.answererId);
486
- // Create replacement offer
487
- this.fillOffers();
488
- }
489
- catch (err) {
490
- // If setRemoteDescription fails, reset the answered flag
491
- activeOffer.answered = false;
492
- this.debug(`Failed to set remote description for offer ${answer.offerId}:`, err);
493
- // Don't throw - continue processing other answers
494
- }
478
+ this.lastPollTimestamp = answer.answeredAt;
479
+ this.emit('offer:answered', answer.offerId, answer.answererId);
480
+ // Create replacement offer
481
+ this.fillOffers();
495
482
  }
496
483
  }
497
484
  // Process ICE candidates
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xtr-dev/rondevu-client",
3
- "version": "0.18.6",
3
+ "version": "0.18.7",
4
4
  "description": "TypeScript client for Rondevu with durable WebRTC connections, automatic reconnection, and message queuing",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",