import { MessageHost } from '../message-host'; import { MessageResponse } from '../message-response.type'; import { RESPONSE } from '../selectors'; import { RTCConnectionArg } from './rtc.type'; declare const CHANNEL_NAME: unique symbol; declare const CHANNEL: unique symbol; declare const CHANNEL_OPEN: unique symbol; declare const DEINITIALIZE: unique symbol; declare const REQUESTS: unique symbol; export declare const READY: unique symbol; export declare const CREATED: unique symbol; /** * WebRTC DataChannel message host that listens for incoming request messages * and dispatches responses over the same negotiated channel. * * Both peers must create the channel with an identical name and negotiated ID. * The ID is derived automatically from the channel name via an FNV-1a hash * unless an explicit `channelId` is supplied. * * Use `@Listen` decorators to register request handlers. The host begins * listening as soon as it is constructed; pass a connection later via * {@link initialize} if one is not available at construction time. * * @example * ```typescript * class GameHost extends RTCMessageHost { * @Listen('move') * handleMove({ data }: { data: [number, number] }): Observable { * return of(applyMove(data)); * } * } * * const host = new GameHost(peerConnection, 'game-events'); * ``` */ export declare class RTCMessageHost extends MessageHost { private [REQUESTS]; private [CHANNEL_NAME]; private [CHANNEL]; private [CHANNEL_OPEN]; private [DEINITIALIZE]; private get [CREATED](); /** Resolves with the `RTCDataChannel` once it has been created (may not yet be open). */ get created(): Promise; private get [READY](); /** Resolves with the `RTCDataChannel` once it is open and ready to transmit. */ get ready(): Promise; /** * @param connection - RTCPeerConnection instance, promise, or factory function. Omit to initialize later via {@link initialize}. * @param channelName - Name for the negotiated data channel. Determines the channel ID via FNV-1a hash. * @param channelId - Explicit negotiated channel ID. Overrides the hash-derived default. */ constructor(connection?: RTCConnectionArg, channelName?: string, channelId?: number); /** * (Re)initializes the data channel with a new connection. * Cleans up the previous channel before establishing a new one. * * @param connection - RTCPeerConnection instance, promise, or factory function. * @param channelId - Optional new channel ID. Defaults to the current channel ID. */ initialize(connection?: RTCConnectionArg, channelId?: number): void; /** Closes the data channel and removes event listeners. */ terminate(): void; protected [RESPONSE](message: MessageResponse): Promise; } export {};