UNPKG

@testrtc/watchrtc-sdk

Version:

Monitor your WebRTC application by collecting WebRTC statistics from end users

178 lines (177 loc) 4.93 kB
export interface RTCPeerConnectionInformation { pc: RTCPeerConnection; id: string; prev?: any; statsRef?: any; validConnection: boolean; } export interface IWatchrtcIdentifiers { rtcRoomId: string | undefined; rtcPeerId: string | undefined; projectId: string | undefined; } export interface IWatchRTCConfiguration { /** Watchrtc api key */ rtcApiKey: string; /** Identifier for the session */ rtcRoomId?: string; /** Identifier for the current peer */ rtcPeerId?: string; /** * ["tag1", "tag2", "tag3"] * @deprecated use 'keys' instead */ rtcTags?: string[]; /** { "key1": "value1", "key2": "value2"} */ keys?: any; /** * @deprecated No longer needed. Use "logLevel" instead. */ debug?: boolean; rtcToken?: string; /** * @deprecated No longer needed. Use "proxyUrl" instead. */ wsUrl?: string; proxyUrl?: string; console?: { level: string; override: boolean; }; allowBrowserLogCollection?: boolean; collectionInterval?: number; logGetStats?: boolean; /** Logging level of SDK */ logLevel?: "silent" | "debug" | "info" | "error"; } export type Rating = 1 | 2 | 3 | 4 | 5; export type EventType = "global" | "local" | "log"; export type Reason = "serverRejectedRetrying" | "serverRejectedNoRetry" | "cantConnectToServer" | "connectedNotResponding" | "disconnectedPrematurely" | "applicationDisconnected" | "clientRejectedNoRetry" | "cantConnectToServerMaxAttemptsNoRetry" | ""; export interface IEvent { name: string; /** "global" or "local" or "log" */ type: EventType; parameters?: any; pc?: any; } export interface IHttpService { trace(url: string, sessionId: string, projectId?: string, // projectID or apiKey rtcRoomId?: string, rtcPeerId?: string, ...data: any[]): Promise<{ error?: string; }>; } export interface IPromiseFuncs { resolve: (value: { error?: string; }) => void; reject: () => void; } interface ISocketTraceOptions { promiseFuncs?: IPromiseFuncs; } interface ISocketTraceParams { data: any[]; options?: ISocketTraceOptions; } export type ISocketTrace = (params: ISocketTraceParams) => void; export interface ISocketConnectOptions { url: string; onData: (data: any) => void; onError: (error: any, errorType?: string) => void; onOpen?: () => void; onClose?: (e: CloseEvent | { code: number; reason: string; wasClean: boolean; }) => void; onNewReference?: (refStats: any) => void; options?: { cleanOldTraces?: boolean; }; } export interface ISocketService { connection: any | null; wasConnected: boolean; buffer: any[]; connect: (params: ISocketConnectOptions) => void; trace: ISocketTrace; close: (nailUpCallEnd?: boolean) => void; disableDataCollection: () => void; enableDataCollection: () => void; isDisabledDataCollection: () => boolean; setStatsStorage: (storage: IStorage) => void; } export interface IWatchRTCInitServices { socketService?: ISocketService; httpService?: IHttpService; } export interface IStatsCallback { (stats: object): void; } export interface IStateEvent { connectionStatus: "connected" | "disconnected"; reason?: Reason; } export type StateListener = (event: IStateEvent) => any; export interface IBackoff { reset: () => void; next: () => number; wait: (timerId: any) => void; unWait: (forceCleaningTimer: boolean) => void; readonly isWaiting: boolean; readonly delayMs: number; readonly attempts: number; readonly MAX_RETRIES_FOR_FIRST_CONNECTION: number; } export interface IStorage { stash: (stats: any) => void; storeRawStats: (stats: any) => void; flushRawStats: (keepId: number) => any; pickupNewReference: () => any; rewriteBuffer: (referenceStats: any) => any; readonly referenceStats: any; readonly stashedStats: any; reset: () => void; } export interface IDevices { setDevices: (listOfDevices: any[]) => void | any; } export interface ISanitize { propertyName: string; maxLength: number; } export interface TestRTCCompanionInfo { name: string; version: string; } export interface TestRTCCompanionStats { general: { os: string; platform: string; version: string; }; cpuInfo: { archName: string; modelName: string; numOfProcessors: string; percentageUsedCpu: string; }; ramInfo: { totalMemory: string; availableMemory: string; usedMemory: string; percentageUsedMemory: string; }; displayInfo: { height: number; width: number; }[]; storageInfo: { totalCapacity: string; _list: { name: string; size: string; }[]; }; } export {};