import { MessageTransport } from './base-message-transport';
import { EventCallback } from '../../../common';

export declare enum KosWSTransportStatus {
    NOT_INITIALIZED = "not_initialized",
    INITIALIZED = "initialized",
    OFFLINE = "OFFLINE",
    ONLINE = "ONLINE"
}
export interface IKosMessage {
    [k: string]: string | number | boolean;
}
export interface IKosConnectionStatus {
    status: string;
    message?: string;
}
export interface KosSubscriptionParams {
    topic: string;
    callback: EventCallback;
    fos?: boolean;
    bridge?: boolean;
    destinationAddress?: string | null;
}
export interface IKosServiceTransport {
    host: string;
    port: number;
    protocol: string;
    token?: string;
    alias?: string;
    connectionEstablished: boolean;
    authorized: boolean;
    socket?: MessageTransport;
    init(): IKosServiceTransport;
    subscribeTopic(params: KosSubscriptionParams): VoidFunction;
    whenReady(): Promise<IKosConnectionStatus>;
    fosSocket?: MessageTransport;
}
export type KosCallback = (msg: IKosMessage) => void;
export declare enum WebSocketEvents {
    CONNECTED = "websocket.connected",
    DISCONNECTED = "websocket.disconnected",
    RELOAD = "websocket.reload"
}
interface WebSocketTransportParams {
    host?: string;
    port?: number;
    protocol?: string;
    token?: string;
    initialize?: boolean;
    alias?: string;
    fos?: {
        port: number;
    };
}
export declare class WebSocketTransport implements IKosServiceTransport {
    private static _instance;
    host: string;
    port: number;
    protocol: string;
    private _token?;
    private webSocketSupported;
    authorized: boolean;
    alias?: string;
    socket?: MessageTransport;
    fosSocket?: MessageTransport;
    fosPort?: number;
    useFosTransport: boolean;
    constructor({ host, port, protocol, token, initialize, alias, fos, }: WebSocketTransportParams);
    get connectionEstablished(): boolean;
    init(): this;
    private _sendSubscriptionMessage;
    subscribeTopic({ topic, callback, fos, bridge, destinationAddress, }: KosSubscriptionParams): () => void;
    whenReady(): Promise<{
        status: string;
    }>;
    get token(): string;
    set token(token: string);
    static host(host?: string): typeof WebSocketTransport;
    static port(port?: number): typeof WebSocketTransport;
    static alias(alias: string): void;
    static getInstance(port?: number, token?: string): IKosServiceTransport;
}
export {};
//# sourceMappingURL=webSocketTransport.d.ts.map