@simplito/privmx-webendpoint
Version:
PrivMX Web Endpoint library
21 lines (20 loc) • 1.08 kB
TypeScript
import { StreamRoomId } from "./types/ApiTypes";
import { SessionId } from "./WebRtcClientTypes";
export type ConnectionType = "publisher" | "subscriber";
export interface JanusConnection {
pc: RTCPeerConnection;
sessionId: SessionId;
hasSubscriptions: boolean;
candidateQueue: RTCIceCandidate[];
}
export declare class PeerConnectionManager {
private createPeerConnection;
private onTrickle;
private connections;
constructor(createPeerConnection: (room: StreamRoomId) => RTCPeerConnection, onTrickle: (sessionId: SessionId, candidate: RTCIceCandidate) => void);
initialize(room: StreamRoomId, connectionType: ConnectionType, sessionId?: SessionId): void;
updateSessionForConnection(room: StreamRoomId, connectionType: ConnectionType, session: SessionId): void;
hasConnection(room: StreamRoomId, connectionType: ConnectionType): boolean;
getConnectionWithSession(room: StreamRoomId, connectionType: ConnectionType): JanusConnection;
closePeerConnectionBySessionIfExists(room: StreamRoomId, connectionType: ConnectionType): void;
}