import type { Advertise, AdvertiseServices, ServiceCallPayload, Unadvertise, UnadvertiseServices } from "@foxglove/ws-protocol";
import { FoxgloveCommunicator, WorkerOutputMessage } from "../communicator";
type GenericMessage = {
    subscriptionId: number;
    data: DataView;
};
export type SystemMessage = Advertise | Unadvertise | AdvertiseServices | UnadvertiseServices | {
    op: "serviceResponse";
    callId: number;
    data: DataView;
};
type ServiceCallMessage = {
    name: string;
    serviceCallId: number;
    body?: Record<string, any>;
};
export type WebRtcWorkerInputMessage = {
    kind: "genericMessage";
    data: {
        message: GenericMessage;
    };
} | {
    kind: "systemMessage";
    data: {
        message: SystemMessage;
    };
} | {
    kind: "connection";
    data: {
        channel: "message" | "system" | null;
        ready: boolean;
    };
} | {
    kind: "serviceCall";
    data: {
        message: ServiceCallMessage;
    };
} | {
    kind: "rawSend";
    data: {
        message: {
            channel: "system" | "message";
            message: string | DataView;
        };
    };
} | {
    kind: "subscribe";
    data: {
        message: {
            topics: string[];
        };
    };
} | {
    kind: "unsubscribe";
    data: {
        message: {
            topics: string[];
        };
    };
} | {
    kind: "disconnect";
    error: Error;
};
export type WebRtcWorkerOutputMessage = {
    type: "send";
    data: {
        channel: "message" | "system";
        data: string | DataView;
    };
};
export declare class WebRtcHandler extends FoxgloveCommunicator {
    #private;
    protected isReady(): boolean;
    send(message: WorkerOutputMessage): void;
    sendWithTransfer(message: WorkerOutputMessage, transfer: ArrayBuffer[]): void;
    subscribe(topics: string[]): void;
    unsubscribe(topics: string[]): void;
    sendServiceCallRequest(args: ServiceCallPayload): void;
    handleRawSend(data: WebRtcWorkerOutputMessage["data"]): void;
    handleConnection(data: (WebRtcWorkerInputMessage & {
        kind: "connection";
    })["data"]): void;
    handleGeneric(message: GenericMessage): void;
    handleDisconnect(error: Error): void;
    handleServiceCall(message: ServiceCallMessage): void;
    handleSystem(message: SystemMessage): void;
}
export {};
//# sourceMappingURL=handler.d.ts.map