@xtr-dev/rondevu-client 0.18.2 → 0.18.4
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/rondevu.d.ts +2 -1
- package/dist/rondevu.js +12 -1
- package/package.json +3 -3
package/dist/rondevu.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RondevuAPI, Keypair, IceCandidate, BatcherOptions } from './api.js';
|
|
2
2
|
import { CryptoAdapter } from './crypto-adapter.js';
|
|
3
|
-
import { EventEmitter } from '
|
|
3
|
+
import { EventEmitter } from 'eventemitter3';
|
|
4
4
|
export type IceServerPreset = 'ipv4-turn' | 'hostname-turns' | 'google-stun' | 'relay-only';
|
|
5
5
|
export declare const ICE_SERVER_PRESETS: Record<IceServerPreset, RTCIceServer[]>;
|
|
6
6
|
export interface RondevuOptions {
|
|
@@ -176,6 +176,7 @@ export declare class Rondevu extends EventEmitter {
|
|
|
176
176
|
private filling;
|
|
177
177
|
private pollingInterval;
|
|
178
178
|
private lastPollTimestamp;
|
|
179
|
+
private isPolling;
|
|
179
180
|
private constructor();
|
|
180
181
|
/**
|
|
181
182
|
* Internal debug logging - only logs if debug mode is enabled
|
package/dist/rondevu.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RondevuAPI } from './api.js';
|
|
2
|
-
import { EventEmitter } from '
|
|
2
|
+
import { EventEmitter } from 'eventemitter3';
|
|
3
3
|
// ICE server presets
|
|
4
4
|
export const ICE_SERVER_PRESETS = {
|
|
5
5
|
'ipv4-turn': [
|
|
@@ -153,6 +153,7 @@ export class Rondevu extends EventEmitter {
|
|
|
153
153
|
this.filling = false;
|
|
154
154
|
this.pollingInterval = null;
|
|
155
155
|
this.lastPollTimestamp = 0;
|
|
156
|
+
this.isPolling = false; // Guard against concurrent poll execution
|
|
156
157
|
this.apiUrl = apiUrl;
|
|
157
158
|
this.username = username;
|
|
158
159
|
this.keypair = keypair;
|
|
@@ -456,6 +457,12 @@ export class Rondevu extends EventEmitter {
|
|
|
456
457
|
async pollInternal() {
|
|
457
458
|
if (!this.filling)
|
|
458
459
|
return;
|
|
460
|
+
// Prevent concurrent poll execution to avoid duplicate answer processing
|
|
461
|
+
if (this.isPolling) {
|
|
462
|
+
this.debug('Poll already in progress, skipping');
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
this.isPolling = true;
|
|
459
466
|
try {
|
|
460
467
|
const result = await this.api.poll(this.lastPollTimestamp);
|
|
461
468
|
// Process answers
|
|
@@ -492,6 +499,9 @@ export class Rondevu extends EventEmitter {
|
|
|
492
499
|
catch (err) {
|
|
493
500
|
console.error('[Rondevu] Polling error:', err);
|
|
494
501
|
}
|
|
502
|
+
finally {
|
|
503
|
+
this.isPolling = false;
|
|
504
|
+
}
|
|
495
505
|
}
|
|
496
506
|
/**
|
|
497
507
|
* Start filling offers and polling for answers/ICE
|
|
@@ -521,6 +531,7 @@ export class Rondevu extends EventEmitter {
|
|
|
521
531
|
stopFilling() {
|
|
522
532
|
this.debug('Stopping offer filling and polling');
|
|
523
533
|
this.filling = false;
|
|
534
|
+
this.isPolling = false; // Reset polling guard
|
|
524
535
|
// Stop polling
|
|
525
536
|
if (this.pollingInterval) {
|
|
526
537
|
clearInterval(this.pollingInterval);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xtr-dev/rondevu-client",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.4",
|
|
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",
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@eslint/js": "^9.39.1",
|
|
28
|
-
"@types/node": "^25.0.2",
|
|
29
28
|
"@typescript-eslint/eslint-plugin": "^8.48.1",
|
|
30
29
|
"@typescript-eslint/parser": "^8.48.1",
|
|
31
30
|
"eslint": "^9.39.1",
|
|
@@ -42,6 +41,7 @@
|
|
|
42
41
|
"README.md"
|
|
43
42
|
],
|
|
44
43
|
"dependencies": {
|
|
45
|
-
"@noble/ed25519": "^3.0.0"
|
|
44
|
+
"@noble/ed25519": "^3.0.0",
|
|
45
|
+
"eventemitter3": "^5.0.1"
|
|
46
46
|
}
|
|
47
47
|
}
|