import { Message } from "protobufjs/light";
import { Observable } from "rxjs";
import { IConnection, Nodes } from "./nodes";
import { Roster } from "./proto";
import { WebSocketAdapter } from "./websocket-adapter";
/**
 * Multi peer connection that tries all nodes one after another. It can send the command to more
 * than one node in parallel and return the first success if 'parallel' i > 1.
 *
 * It uses the Nodes class to manage which nodes will be contacted.
 */
export declare class RosterWSConnection implements IConnection {
    private service;
    static defaultParallel: number;
    private static totalConnNbr;
    private static nodes;
    nodes: Nodes;
    private readonly connNbr;
    private msgNbr;
    private parallel;
    private rID;
    /**
     * @param r         The roster to use or the rID of the Nodes
     * @param service   The name of the service to reach
     * @param parallel  How many nodes to contact in parallel. Can be changed afterwards
     */
    constructor(r: Roster | string, service: string, parallel?: number);
    /**
     * Set a new parameter for how many nodes should be contacted in parallel.
     * @param p
     */
    setParallel(p: number): void;
    /**
     * Sends a message to conodes in parallel. As soon as one of the conodes returns
     * success, the message is returned. If a conode returns an error (or times out),
     * a next conode from this.addresses is contacted. If all conodes return an error,
     * the promise is rejected.
     *
     * @param message the message to send
     * @param reply the type of the message to return
     */
    send<T extends Message>(message: Message, reply: typeof Message): Promise<T>;
    /**
     * To be conform with an IConnection
     */
    getURL(): string;
    /**
     * To be conform with an IConnection - sets the timeout on all connections.
     */
    setTimeout(value: number): void;
    /** @inheritdoc */
    sendStream<T extends Message>(message: Message, reply: typeof Message): Observable<[T, WebSocketAdapter]>;
    /**
     * Return a new RosterWSConnection for the given service.
     * @param service
     */
    copy(service: string): RosterWSConnection;
    /**
     * Invalidate a given address.
     * @param address
     */
    invalidate(address: string): void;
    /**
     * Update roster for this connection.
     * @param r
     */
    setRoster(r: Roster): void;
}
