import type { CometD, SubscriptionHandle, Listener as CometDListener, Callback as CometDCallback, HandshakeMessage as CometDHandshakeMessage, Message as CometDMessage } from 'cometd';
import { IFetchClient } from '../core';
export interface ICometdConfig {
    url: string;
    logLevel?: string;
    requestHeaders?: any;
    appendMessageTypeToURL?: boolean;
    stickyReconnect?: boolean;
}
export declare class Realtime {
    private client;
    private url;
    private handshakeCallback?;
    /**
     * only initializing cometd if it is actually needed
     * trying to save some memory here
     */
    protected get cometd(): CometD;
    private _cometd;
    /**
     * Allows to set up a realtime (websocket or long-polling) connection to the platform.
     * @param client The fetch client instance to use
     * @param url The URL to connect to
     * @param handshakeCallback A function which is called on succeeded or failed handshake
     */
    constructor(client: IFetchClient, url?: string, handshakeCallback?: (msg: CometDHandshakeMessage) => void);
    /**
     * Subscribes to a realtime channel to listen for data.
     * @param channel The channel to connect to
     * @param callback A function to call when data is received
     */
    subscribe(channel: string, callback: CometDCallback): SubscriptionHandle;
    /**
     * Cancels the listening to a channel.
     * @param subscription The subscription object returned by subscribe()
     */
    unsubscribe(subscription: SubscriptionHandle): void;
    /**
     * Allows to listen to Cometd handshake to find out if e.g. the connection was reestablished.
     */
    addHandshakeListener(callback: (msg: CometDHandshakeMessage) => void): SubscriptionHandle;
    /**
     * Allows to listen to Cometd connection to e.g. detect when connection was lost.
     */
    addConnectListener(callback: (msg: CometDMessage) => void): SubscriptionHandle;
    /**
     * Removes the subscription obtained with a call to `addHandshakeListener` or `addConnectListener`.
     */
    removeListener(subscriptionHandle: SubscriptionHandle): void;
    /**
     * Resubscribes as necessary in case of a re-handshake.
     */
    resubscribe(subscriptionHandle: SubscriptionHandle): SubscriptionHandle;
    /**
     * Disconnects the current connection.
     */
    disconnect(disconnectCallback?: CometDListener): void;
    /**
     * Returns true if the CometD instance is disconnected or disconnecting.
     */
    isDisconnected(): boolean;
    private checkConnection;
    private handshake;
    private metaHandshake;
}
//# sourceMappingURL=Realtime.d.ts.map