/// <reference types="node" />
import 'babel-polyfill';
import { EventEmitter } from 'events';
import { DiscoverOptions } from './discover';
export interface IFucmenNode {
    id: string;
    host: string;
    master: boolean;
    adv: any;
}
export declare class Fucmen extends EventEmitter {
    private allNodes;
    private discover;
    constructor(advertisement: any, discoveryOptions: DiscoverOptions);
    readonly id: string;
    readonly isMaster: boolean;
    readonly nodes: IFucmenNode[];
    readonly connections: IFucmenNode[];
    setAdvertisement(advertisement?: any): Promise<void>;
    setMasterEligible(): Promise<void>;
    promote(): Promise<void>;
    demote(permanent: boolean): Promise<void>;
    publish(channel: string, ...data: any[]): Promise<boolean>;
    join(channel: string, listener: (...data: any[]) => void, withFrom?: false): boolean;
    join(channel: string, listener: (from: IFucmenNode | undefined, ...data: any[]) => void, withFrom: true): boolean;
    leave(channel: string): boolean;
    sendTo(id: string, reliableMaxRetries: boolean | number, ...data: any[]): Promise<boolean>;
    onDirectMessage(listener: (...data: any[]) => void, withFrom?: false): void;
    onDirectMessage(listener: (from: IFucmenNode | undefined, ...data: any[]) => void, withFrom: true): void;
    restart(): Promise<boolean>;
    private getNodeFromId(id);
}
