/** * PollingManager - Centralized polling for WebRTC signaling * * Provides a single shared polling timer that emits events for: * - poll:answer - When an offer receives an answer * - poll:ice - When new ICE candidates are available * * Connections subscribe to these events and filter by offerId in their callbacks. */ import { EventEmitter } from 'eventemitter3'; import { RondevuAPI, IceCandidate } from '../api/client.js'; export interface PollAnswerEvent { offerId: string; answererPublicKey: string; sdp: string; answeredAt: number; matchedTags?: string[]; } export interface PollIceEvent { offerId: string; candidates: IceCandidate[]; } export interface PollingManagerEvents { 'poll:answer': (data: PollAnswerEvent) => void; 'poll:ice': (data: PollIceEvent) => void; 'poll:error': (error: Error) => void; 'poll:started': () => void; 'poll:stopped': () => void; } export interface PollingManagerOptions { api: RondevuAPI; intervalMs?: number; debugEnabled?: boolean; } /** * Centralized polling manager that emits global events * Connections subscribe to events and filter by offerId */ export declare class PollingManager extends EventEmitter { private static readonly DEFAULT_INTERVAL_MS; private readonly api; private readonly intervalMs; private readonly debugEnabled; private pollingInterval; private lastPollTimestamp; private running; constructor(options: PollingManagerOptions); /** * Start polling */ start(): void; /** * Stop polling */ stop(): void; /** * Check if polling is active */ isRunning(): boolean; /** * Get the last poll timestamp */ getLastPollTimestamp(): number; /** * Perform a single poll */ private poll; /** * Debug logging */ private debug; }