import { Message } from "protobufjs";
import { Observable } from "rxjs";
import { IConnection } from "./nodes";
import { Roster } from "./proto";
import { WebSocketAdapter } from "./websocket-adapter";
/**
 * Set the websocket generator. The default one is compatible
 * with browsers and nodejs.
 * @param generator A function taking a path and creating a websocket adapter instance
 */
export declare function setFactory(generator: (path: string) => WebSocketAdapter): void;
/**
 * Single peer connection to one single node.
 */
export declare class WebSocketConnection implements IConnection {
    private readonly url;
    private readonly service;
    private timeout;
    /**
     * @param addr      Absolute address of the distant peer
     * @param service   Name of the service to reach
     */
    constructor(addr: string | URL, service: string);
    /** @inheritdoc */
    getURL(): string;
    /** @inheritdoc */
    setTimeout(value: number): void;
    /** @inheritdoc */
    send<T extends Message>(message: Message, reply: typeof Message): Promise<T>;
    copy(service: string): IConnection;
    /**
     * @deprecated - use directly a RosterWSConnection if you want that
     * @param p
     */
    setParallel(p: number): void;
    /** @inheritdoc */
    sendStream<T extends Message>(message: Message, reply: typeof Message): Observable<[T, WebSocketAdapter]>;
}
/**
 * Single peer connection that reaches only the leader of the roster
 */
export declare class LeaderConnection extends WebSocketConnection {
    /**
     * @param roster    The roster to use
     * @param service   The name of the service
     */
    constructor(roster: Roster, service: string);
}
