@signalwire/js
Version:
63 lines • 1.72 kB
TypeScript
export declare class RTCPeerConnectionManager {
private pool;
private config;
private poolSize;
private forceRefresh;
private turnRefreshInterval;
private refreshTimer?;
private logger;
constructor(config: RTCConfiguration, poolSize?: number, forceRefresh?: boolean);
/**
* Initialize the connection pool
*/
initializePool(): Promise<void>;
/**
* Get a pre-warmed connection from the pool
*/
getConnection(): RTCPeerConnection | null;
/**
* Clean up the manager and all connections
*/
cleanup(): void;
/**
* Create a new pooled connection with pre-gathered ICE candidates
*/
private createPooledConnection;
/**
* Wait for ICE gathering to complete or timeout
*/
private waitForIceGathering;
/**
* Clean up mock tracks and event listeners before handing off connection
*/
private cleanupMockTracks;
/**
* Remove all event listeners from RTCPeerConnection
*/
private cleanupEventListeners;
/**
* Check if a pooled connection is still valid
*/
private isConnectionValid;
/**
* Replenish the pool to maintain desired size
*/
private replenishPool;
/**
* Start the maintenance worker for TURN refresh
*/
private startMaintenanceWorker;
/**
* Refresh TURN allocations for all pooled connections
*/
private refreshTurnAllocations;
/**
* Refresh a connection's TURN allocation using ICE restart
*/
private refreshConnection;
/**
* Close a connection and clean up resources
*/
private closeConnection;
}
//# sourceMappingURL=RTCPeerConnectionManager.d.ts.map