import { Transport } from './transport';
export declare enum WebSocketEvents {
    CONNECTED = "websocket.connected",
    DISCONNECTED = "websocket.disconnected",
    ERROR = "websocket.error",
    MAX_RETRIES_EXCEEDED = "websocket.max_retries_exceeded",
    RELOAD = "websocket.reload"
}
export interface TransportParams {
    host: string;
    port: number;
    protocol: string;
    alias?: string;
    onConnectionEstablished?: () => void;
    onConnectionLost?: () => void;
    Transport?: new (url: string) => Transport;
}
export interface MessageTransport {
    socket: Transport;
    send: (data: string | ArrayBufferLike | Blob | ArrayBufferView) => void;
    connectionEstablished: boolean;
    addOfflineMessage: (msg: string) => void;
}
export interface KosInternalEvent {
    headers: Record<string | `topic` | `http-request-id`, string>;
    body: string;
}
interface OfflineMessage {
    msg: string;
    fos?: boolean;
}
export declare function processKosMessage(data: string): KosInternalEvent;
export declare function processKosSnifferMessage(data: string): KosInternalEvent;
export declare abstract class BaseTransport implements MessageTransport {
    protected host: string;
    protected port: number;
    protected protocol: string;
    socket: Transport;
    connectionEstablished: boolean;
    private alias?;
    private onConnectionEstablished?;
    private onConnectionLost?;
    protected offlineMessages: OfflineMessage[];
    protected abstract RESPONSE_ID_HEADER: string;
    private oldSend;
    constructor({ host, port, protocol, alias, onConnectionEstablished, onConnectionLost, Transport, }: TransportParams);
    addOfflineMessage(msg: string): void;
    processMessageEvent(msg: MessageEvent): KosInternalEvent;
    onMessage(event: Event): void;
    onOpen(event: Event): void;
    onClose(event: CloseEvent): void;
    onError(ev: Event): void;
    /**
     * Determines whether to attempt reconnection based on WebSocket close code.
     * @param code - The WebSocket close code
     * @returns true if reconnection should be attempted
     */
    private shouldAttemptReconnection;
    send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void;
}
export {};
//# sourceMappingURL=base-message-transport.d.ts.map