/** * Client type classification by protocol. */ export type ClientType = "hls" | "mpegts"; /** * Count of clients for a specific client type. */ export interface ClientTypeCount { count: number; type: ClientType; } /** * Aggregated client summary for a stream. */ export interface ClientSummary { clients: ClientTypeCount[]; total: number; } /** * Registers or refreshes a client for a stream. For HLS clients, this updates the lastSeen timestamp to prevent TTL expiration. For MPEG-TS clients, this creates * the client entry on connect. Guards against registration after stream termination by verifying the stream still exists in the registry. * @param streamId - The numeric stream ID. * @param clientAddress - The raw client IP address. * @param protocol - The protocol ("hls" or "mpegts"). */ export declare function registerClient(streamId: number, clientAddress: string, protocol: ClientType): void; /** * Unregisters a client from a stream. Used for MPEG-TS clients on disconnect. HLS clients are not explicitly unregistered — they expire via TTL cleanup in * getClientSummary(). If the client map has already been cleared (e.g., during stream termination), this is a no-op. * @param streamId - The numeric stream ID. * @param clientAddress - The raw client IP address. * @param protocol - The protocol ("hls" or "mpegts"). */ export declare function unregisterClient(streamId: number, clientAddress: string, protocol: ClientType): void; /** * Returns an aggregated client summary for a stream. Performs lazy TTL cleanup of stale HLS clients as a side effect — entries that have not been refreshed within * HLS_CLIENT_TTL are removed. MPEG-TS clients are managed explicitly via register/unregister and are never expired by TTL. * * Called by the monitor every ~2 seconds during status emission. * @param streamId - The numeric stream ID. * @returns The client summary with total count and per-type breakdown. */ export declare function getClientSummary(streamId: number): ClientSummary; /** * Removes all client tracking data for a stream. Called during stream termination to prevent memory leaks. * @param streamId - The numeric stream ID. */ export declare function clearClients(streamId: number): void;