/*!
 * Copyright 2017 - 2020 by ChartIQ, Inc.
 * All rights reserved.
 */
import { StandardError, StandardErrorCallback } from "../types";
export declare type RouterTransportSettings = {
    FinsembleTransport?: {
        serverAddress?: string;
    };
};
export declare type RouterConfig = {
    windowName: string;
    notificationURL?: string;
    transportSettings?: RouterTransportSettings;
    /**
     * Only required for shared worker
     */
    routerDomainRoot?: string;
    /**
     * Which transport to enable. Use Startup/RouterConfig.getRecommendedTransport() Set this to "FinsembleTransport" when in freestanding mode.
     */
    transportName: string;
};
declare type AvailableTransports = "SharedWorker" | "IPCBus";
declare type IncomingTransportInfo = {
    port?: number;
    transportID: AvailableTransports;
    lastClient: string;
    origin: string;
};
declare type RouterHeader = {
    channel: string;
    origin: string;
    incomingTransportInfo: IncomingTransportInfo;
    lastClient: string;
    originIncomingTransportInfo: {
        transportID: AvailableTransports;
    };
    type: string;
};
export interface RouterResponse<T> {
    data: T;
    header: RouterHeader;
}
export interface RouterMessage<T = any> extends RouterResponse<T> {
    options: {
        supressWarnings: boolean;
    };
    originatedHere(): boolean;
}
/**
 * Call this to unsubscribe to a prior listener call.
 */
export declare type RouterListenerUnsubscribe = () => void;
declare type SendToRouter = {
    header: {
        origin: string;
        type: string;
        [key: string]: any;
    };
};
declare type TransmitMessage<T = any> = SendToRouter & {
    header: {
        type: "transmit";
        channel: string;
    };
    data: T;
    options?: {
        suppressWarnings: boolean;
    };
};
declare type TransmitMessageFromService<T = any> = RouterMessage<T> & TransmitMessage<T>;
export declare type ListenerResponse<T = any> = TransmitMessageFromService<T> & {
    originatedHere: () => void;
};
declare type ListenerCallback<T = any> = (err: null, response: ListenerResponse<T>) => void;
interface QueryMessage<T = any> extends SendToRouter {
    header: {
        origin: string;
        type: "query";
        queryID: string;
        channel: string;
        logWhenNoResponder: boolean;
        error?: string | null;
    };
    data: T;
}
declare type QueryMessageFromService<T = any> = RouterMessage<T> & QueryMessage<T>;
/**
 * Q = type of query (sent by client call to query() )
 * R = type of response (returned by server call to sendQueryResponse() )
 */
export declare type ResponderMessage<Q = any, R = any> = QueryMessageFromService<Q> & {
    sendQueryResponse(error: StandardError, data?: R): any;
    originatedHere: () => void;
};
declare type QueryResponseMessage<T = any> = SendToRouter & {
    header: {
        type: "queryResponse";
        queryID: string;
        error?: string | null;
    };
    data?: T;
};
declare type QueryResponseFromService<T = any> = RouterMessage<T> & QueryResponseMessage<T>;
export declare type QueryResponse<T = any> = {
    data?: T;
    header: RouterHeader;
};
export declare type QueryResponseCallback<T = any> = (err: null | string, response: QueryResponse<T>) => void;
export declare type StandardQueryResponse<T = any> = {
    err?: null | string;
    response: QueryResponse<T>;
};
/** Section: subscribe() / addPubSubResponder() / removePubSubResponder() */
interface SubscribeMessage extends SendToRouter {
    header: {
        origin: string;
        type: "subscribe";
        subscribeID: string;
        topic: string;
        error?: string | null;
    };
}
declare type SubscribeMessageFromService = RouterMessage & SubscribeMessage;
export declare type SubscribeHookMessage<T = any> = SubscribeMessageFromService & {
    sendNotifyToSubscriber: (err: string | null, data?: T) => void;
};
export declare type SubscriberResponse<T = any> = SendToRouter & {
    header: {
        topic: string;
        subscribeID: string;
        error?: string | null;
    };
    data: T;
    originatedHere: () => boolean;
};
interface UnsubscribeMessage extends SendToRouter {
    header: {
        origin: string;
        type: "unsubscribe";
        subscribeID: string;
        topic: string;
    };
}
declare type UnsubscribeMessageFromService = RouterMessage & UnsubscribeMessage;
export declare type UnsubscribeHookMessage = UnsubscribeMessageFromService & {
    removeSubscriber: () => void;
};
interface PublishMessage<T = any> extends SendToRouter {
    header: {
        origin: string;
        type: "publish";
        topic: string;
    };
    data: T;
}
declare type PublishMessageFromService<T = any> = RouterMessage<T> & PublishMessage<T>;
export declare type PublishHookMessage<T = any> = PublishMessageFromService & {
    sendNotifyToAllSubscribers: (err: string | null, data: T) => void;
};
declare type NotifyMessage<T = any> = SendToRouter & {
    header: {
        type: "notify";
        subscribeID: string;
        topic: string;
        error?: string;
    };
    data: T;
};
declare type NotifyMessageFromService<T = any> = RouterMessage & NotifyMessage<T>;
declare type NotifyCallback<T = any> = (err: StandardError, response: SubscriberResponse<T>) => void;
export declare type SubscribeCallback<T = any> = (err: null, data: SubscribeHookMessage<T>) => void;
export declare type UnsubscribeCallback = (err: null, data: UnsubscribeHookMessage) => void;
export declare type PublishCallback<T = any> = (err: null, data: PublishHookMessage<T>) => void;
/**
 * @introduction
 *
 * <h2>Router Client</h2>
 *
 * The Router Client sends and receives event messages between Finsemble components and services. See the <a href=tutorial-TheRouter.html>Router tutorial</a> for an overview of the Router's functionality.
 *
 * Router callbacks for incoming messages are **always** in the form `callback(error, event)`. If `error` is null, then the incoming data is always in `event.data`. If `error` is set, it contains a diagnostic object and message. On error, the `event` parameter is not undefined.
 *
 *
 * @constructor
 * @hideconstructor
 * @publishedName RouterClient
 */
export declare class RouterConnection {
    queue: SendToRouter[];
    started: boolean;
    handshakeHandler: any;
    timeCalibrationHandler: any;
    clientName: string;
    transport: any;
    isRouterReady: boolean;
    parentReadyCallbackQueue: (() => void)[];
    notificationURL: string;
    mapListeners: Record<string, ListenerCallback[]>;
    mapQueryResponders: Record<string, StandardErrorCallback<ResponderMessage<any, any>>>;
    mapPubSubResponders: Record<string, {
        subscribeCallback?: SubscribeCallback;
        publishCallback?: PublishCallback;
        unsubscribeCallback?: UnsubscribeCallback;
    }>;
    mapPubSubResponderState: Record<string, any>;
    mapPubSubResponderRegEx: Record<string, RegExp>;
    pubsubListOfSubscribers: Record<string, string[]>;
    mapSubscribersID: Record<string, NotifyCallback>;
    mapSubscribersTopic: Record<string, string>;
    mapQueryResponses: Record<string, QueryResponseCallback>;
    mapQueryResponseTimeOut: Record<string, any>;
    constructor();
    onReadyCallBack(): void;
    sendToRouterService(message: SendToRouter): void;
    originatedHere(message: SendToRouter): boolean;
    invokeListeners(message: TransmitMessageFromService): void;
    /**
     * When an incoming query request is received from a client (via the RouterService) we look
     * up the registered responder and pass it the incoming query along with
     * a sendQueryResponse() method that will return the data back to the client.
     */
    invokeResponder(queryMessage: QueryMessageFromService): void;
    /**
     * Received a query response back from the router service. Look up the callback
     * and invoke it with the received data.
     */
    invokeQueryResponse(message: QueryResponseFromService): void;
    /**
     * Updates pub/sub subscriptions whenever state updates (or on initial subscribe to the topic).
     * This looks up local subscribers and calls them with the pub/sub state.
     */
    invokeNotifyCallback(notifyMessage: NotifyMessageFromService): void;
    /**
     * Returns a responder given a topic. The topic could be a regex key, in
     * which case mapPubSubResponderRegEx is searched
     */
    private findResponder;
    invokePublishEvent(publishMessage: PublishMessageFromService): void;
    invokeSubscribeEvent(subscribeMessage: SubscribeMessageFromService): void;
    invokeUnsubscribeEvent(unsubscribeMessage: UnsubscribeMessageFromService): void;
    sendNotifyToSubscriber(subscribeMessage: SubscribeMessageFromService, err: string | null, notifyData?: any): void;
    removeSubscribers(topic: string, subscribeID: string): void;
    routeIncomingMessage(incomingMessage: SendToRouter): void;
    asyncConnectToEventRouter(routerConfig: RouterConfig, transportName: string, cb?: () => void): void;
    addPubSubResponderCallBack<T>(topic: string | RegExp, subscribeCallback?: SubscribeCallback<T>, publishCallback?: PublishCallback<T>, unsubscribeCallback?: UnsubscribeCallback): boolean;
    /**
     * Estimates offset to align the reference time with Router Service.  Does this by exchanging messages with RouterService, getting the service's time, and estimating communication delay.
     */
    calibrateTimeWithRouterService(callback: (offset: number) => void): void;
    /**
     * Starts the router client, creating a unique name to represent this instance, initiating the
     * transport that is specified in routerConfig, and then registering itself with the router
     * service. Most of this work occurs in the internal function `asyncConnectToEventRouter()`.
     */
    start(routerConfig: RouterConfig): Promise<string | null>;
    /**
     * Stops the router. This disconnects all responders and listeners and closes all transports.
     * Once stopped, a router may be started again.
     */
    stop(): void;
    onReady(cb?: () => void): Promise<void>;
    addListener<T = any>(channel: string, eventHandler: (err: null, response: ListenerResponse<T>) => void): RouterListenerUnsubscribe;
    transmit<T = any>(toChannel: string, data: T, options?: {
        suppressWarnings: boolean;
    }): void;
    removeListener(channel: string, eventHandler: Function): void;
    addResponder<Q = any, R = any>(channel: string, queryEventHandler: StandardErrorCallback<ResponderMessage<Q, R>>): void;
    query<Q = any, R = any>(responderChannel: string, queryEvent: Q, queryParams: {
        timeout?: number;
        logWhenNoResponder?: boolean;
    } | QueryResponseCallback<R> | undefined, responseEventHandler?: QueryResponseCallback<R>): Promise<StandardQueryResponse<R>>;
    removeResponder(responderChannel: string): void;
    addPubSubResponder<T = any>(topic: string | RegExp, initialState?: object, params?: {
        subscribeCallback?: SubscribeCallback<T>;
        unsubscribeCallback?: UnsubscribeCallback;
        publishCallback?: PublishCallback<T>;
    }, callback?: (err?: string | Error, result?: "success") => void): void;
    removePubSubResponder(topic: string | RegExp): void;
    subscribe<T = any>(topic: string, notifyCallback: (err: StandardError, response: SubscriberResponse<T>) => void): {
        subscribeID: string;
        topic: string;
    };
    publish<T = any>(topic: string, data: T): void;
    unsubscribe(subscribeIDStruct: {
        subscribeID: string;
        topic: string;
    }): void;
    /**
     * Test an incoming router message to see if it originated from the same origin (e.g. a trusted source...not cross-domain). Currently same origin is known only because a sharedWorker transport is used (by definition SharedWorkers do not work cross-domain).  This means any message coming in over the Inter-application Bus will not be trusted; however, by default all same-origin components and services connect to the router using a SharedWorker transport.
     * @param {object} incomingMessage an incoming router message (e.g. transmit, query, notification) to test to see if trusted.
     *
     * @example
     * FSBL.Clients.RouterClient.trustedMessage(incomingRouterMessage);
     */
    trustedMessage(incomingMessage: RouterMessage): boolean;
    disconnectAll(): void;
}
export declare const RouterController: {
    /**
     * Used to start the router. This is called by entry points (FSBLDesktop.ts, FSBLFreestanding.ts, FSBLService.ts [ in baseService, serviceManager's bootEngine.ts, logger's main.jsx ]  )
     * @private
     */
    start: (params: RouterConfig) => Promise<string | null>;
    /**
     * Used to stop the router. Generally used for unit testing.
     * @private
     */
    stop: () => void;
    /**
     * Used internally by Logger client
     */
    calibrateTimeWithRouterService(callback: (offset: number) => void): void;
};
/**
 * @introduction
 * <h2>Router Client (Finsemble Workspaces)</h2>
 *
 * For communications amongst desktop services, components, or outside the container entirely, Finsemble provides an event infrastructure with high level protocols.
 * The Router is the center of this functionality, sending and receiving messages between windows.
 *
 *
 * See the [Router tutorial](tutorial-TheRouter.html) for an overview.
 *
 * @hideconstructor
 * @constructor
 */
export declare const RouterClient: {
    /**
     * Checks if Router is ready. May be invoked multiple times. Invokes optional callback and resolves promise when ready, which may be immediately.  Router is not ready until underlying transport to Router Service is ready.
     *
     * @param {function} [cb] Optional callback function to invoke when Router is ready.
     * @return {Promise} Promise resolves when Router is ready
     * @deprecated Don't use this method. (Apps that use the FSBL API and wait on the global `onReady` event are guaranteed that the router will be ready). Internal code
     * should wait on Startup.onReady().
     */
    onReady: (cb?: (() => void) | undefined) => Promise<void>;
    /**
     * Adds a listener for incoming transmit events on the specified channel. Each of the incoming events will trigger the specified event handler. The number of listeners is not limited (either local to this Finsemble window or in a separate Finsemble window).
     *
     * See <code>transmit</code> for sending a corresponding event message to the listener. See <code>removeListener</code> to remove the listener.
     *
     * @param {string} channel A unique string to identify the channel (must match corresponding transmit channel name).
     * @param {function} eventHandler A callback handling any possible error and the response. Use <b>response.originatedHere()</b> to determine if the message came from the same window. (see example below).
     * @return {RouterListenerUnsubscribe} Returns a function that can be called to unsubscribe (convenient alternative to removeListener)
     * @example
     *
     * FSBL.Clients.RouterClient.addListener("SomeChannelName", function (error, response) {
     * 	if (error) {
     *  		Logger.system.error("ChannelA Error: " + JSON.stringify(error));
     * 	} else {
     *  		var data response.data;
     *  		if (response.originatedHere()) {
     *   			Logger.system.warn("Received a message from the calling window, ignoring");
     *  		} else {
     * 			// Logic to perform with data
     * 		}
     * 	}
     * });
     */
    addListener: <T = any>(channel: string, eventHandler: (err: null, response: ListenerResponse<T>) => void) => RouterListenerUnsubscribe;
    /**
     * Transmits data to all listeners on the specified channel. If there are no listeners on the channel, the event is discarded without error. All listeners on the channel in this Finsemble window and other Finsemble windows will receive the transmit.
     *
     * See <code>addListener</code> to add a listener to receive the transmit.
     *
     * @param {string} toChannel A unique string to identify the channel (must match corresponding listener channel name).
     * @param {any} data An object or primitive type to be transmitted.
     * @param {object} options An object containing options for your transmission.
     * @param {boolean} options.suppressWarnings By default, the Router will log warnings if you transmit to a channel with no listeners. Set this to true to eliminate those warnings.
     * @example
     *
     * FSBL.Clients.RouterClient.transmit("SomeChannelName", event);
     *
     */
    transmit: <T_1 = any>(toChannel: string, data: T_1, options?: {
        suppressWarnings: boolean;
    } | undefined) => void;
    /**
     * Removes an event listener from the specified channel for the specific event handler; only listeners created locally can be removed.
     *
     * See <code>addListener</code> for corresponding add of a listener.
     *
     * @param {string} channel The unique channel name from which to remove the listener.
     * @param {function} eventHandler Function used for the event handler when the listener was added.
     */
    removeListener: (channel: string, eventHandler: Function) => void;
    /**
     * Adds a query responder to the specified channel. The responder's <code>queryEventHandler</code> function will receive all incoming queries for the specified channel (whether from this Finsemble window or remote Finsemble windows).
     *
     * <b>Note:</b> Only one responder is allowed per channel within Finsemble.
     *
     * See <code>query</code> for sending a corresponding query-event message to this responder.
     *
     * @param {string} channel A unique string to identify the channel (must match corresponding query channel name); only one responder is allowed per channel.
     * @param {StandardCallback} queryEventHandler A function to handle the incoming query (see example below); note the incoming <code>queryMessage</code> contains a function to send the response.
     * @example
     *
     * FSBL.Clients.RouterClient.addResponder("ResponderChannelName", function (error, queryMessage) {
     *	if (error) {
     *		Logger.system.log('addResponder failed: ' + JSON.stringify(error));
     *	} else {
     *		console.log("incoming data=" + queryMessage.data);
     * 		var response="Back at ya"; // Responses can be objects or strings
     * 		queryMessage.sendQueryResponse(null, response); // The callback must respond, else a timeout will occur on the querying client.
     * 	}
     * });
     *
     */
    addResponder: <Q = any, R = any>(channel: string, queryEventHandler: StandardErrorCallback<ResponderMessage<Q, R>>) => void;
    /**
     * Sends a query to the responder listening on the specified channel. The responder may be in this Finsemble window or another Finsemble window.
     *
     *
     * See <code>addResponder</code> to add a responder to receive the query.
     *
     * @param {string} responderChannel A unique string that identifies the channel (must match the channel name on which a responder is listening).
     * @param {object} queryEvent The event message sent to the responder.
     * @param {function} responseEventHandler An event handler to receive the query response (sent from a responder that is listening on this channel).
     *
     * @example
     *
     * FSBL.Clients.RouterClient.query("someChannelName", {}, function (error, queryResponseMessage) {
     *	if (error) {
     *		Logger.system.log('query failed: ' + JSON.stringify(error));
     *	} else {
     *		// process income query response message
     *		var responseData = queryResponseMessage.data;
     *		Logger.system.log('query response: ' + JSON.stringify(queryResponseMessage));
     *	}
     * });
     *
     * FSBL.Clients.RouterClient.query("someChannelName", { queryKey: "abc123"}, { timeout: 1000 }, function (error, queryResponseMessage) {
     *	if (!error) {
     *		// process income query response message
     *		var responseData = queryResponseMessage.data;
     *	}
     * }); */
    query: <Q_1 = any, R_1 = any>(responderChannel: string, queryEvent: Q_1, queryParams?: {
        timeout?: number | undefined;
        logWhenNoResponder?: boolean | undefined;
    } | QueryResponseCallback<R_1> | undefined, responseEventHandler?: QueryResponseCallback<R_1> | undefined) => Promise<StandardQueryResponse<R_1>>;
    /**
     * Removes the query responder from the specified channel. Only a locally added responder can be removed (i.e., a responder defined in the same component or service).
     *
     * See [addResponder]{@link RouterClient#addResponder} for adding a query responder.
     *
     * @param {string} responderChannel String identifying the channel from which to remove the responder.
     *
     * @example
     *
     * FSBL.Clients.RouterClient.removeResponder("someChannelName");
     *
     */
    removeResponder: (responderChannel: string) => void;
    /**
     * Adds a PubSub responder for the specified topic (either a specific string or a regular-expression match). PubSub
     * topics are stateful. New subscribers to the topic are automatically provided the most recent state.
     * Once a responder has been added, other apps can subscribe to and publish state on the topic
     *
     * See [`publish()`]{@link RouterClient.html#publish} and [`subscribe()`]{@link RouterClient.html#subscribe}.
     *
     * Only one responder may be set per topic across the entire system (otherwise a warning will show in Central Logger).
     * If another responder is set with an overlapping regular-expression then the responder with an exact string is still guaranteed to get the messages
     * (the regex responder will not receive messages that match a responder with a matching string).
     *
     * > If multiple responders are set with _overlapping_ regular-expressions, then the receiver is _indeterminate_.
     *
     * When initializing a responder, hooks can be provided to intercept and manipulate publish, subscribe, and unsubscribe events (see parameters).
     *
     * @param string|RegExp topic A unique topic for this responder, or a RegEx (e.g. '/abc.+/') to handle a set of topics.
     * @param {object} initialState The initial state for the topic (defaults to `{}`).
     * @param {object} params Optional hooks
     * @param {function} params.publishCallback This hook is called whenever a remote app publishes new state.
     * `[arg2].sendNotifyToAllSubscribers()` must be called to complete the publication but can send a different state than what was published by the originating app
     * (the originating publishing app will receive this state on its subscriptions).
     * See example below.
     *
     * @param {function} params.subscribeCallback This hook is called whenever a remote app subscribes to this responder's topic.
     * It can be used to deny subscriptions or to run independent code for any new subscription.
     * `[arg2].sendNotifyToSubscriber()` must be called in order for the responder to complete the subscription, and can optionally provide
     * the subscribing app with a different initial than the topic's current state.
     * See example below.
     *
     * @param {function} params.unsubscribeCallback This hook is called whenever a remote app unsubscribes from this responder's topic.
     * `[arg2].removeSubscriber()` must be called in order to complete the unsubscription.
     * See example below.
     *
     * @param {function} callback An optional callback function which should accept a possible error.
     * If `addPubSubResponder()` failed then the first parameter to the callback will contain the error condition.
     * The most common error is when adding a responder for a topic that already has a responder:
     * "RouterClient.addPubSubResponder: Responder already locally defined for topic ${topic}";
     *
     * @example
     *
     * // Example, initializing a responder without any optional hooks:
     * FSBL.Clients.RouterClient.addPubSubResponder("topicABC", { "State": "start" });
     *
     * // Example, initializing a responder with a regex for matching topics:
     * FSBL.Clients.RouterClient.addPubSubResponder(\/topicA*\/, { "State": "start" });
     *
     * // Example, initializing a responder with all three hooks and an initial state:
     * FSBL.Clients.RouterClient.addPubSubResponder("topicABC", { "State": "start" },
     * 	{
     * 		subscribeCallback:subscribeCallback,
     * 		publishCallback:publishCallback,
     * 		unsubscribeCallback:unsubscribeCallback
     * 	});
     *
     * // Example publish hook:
     * function publishCallback(error, publish) {
     * 	if (publish) {
     * 		// `publish.data` contains the data that the originating app published.
     * 		console.log(publish.data);
     *
     * 		// This function must be called to complete the publication. Set the first parameter to `null`
     * 		// to complete the publication. Set the first parameter to a string in order to suppress the publication
     * 		// and return an error to the publisher.
     * 		//
     * 		// The second parameter must contain the data that you wish to publish. This data will be sent to all
     * 		// subscribers including the originating app. It can be either the originating state (from `publish.data`)
     * 		// or a different/manipulated state. This will become the new current state for the topic.
     * 		publish.sendNotifyToAllSubscribers(null, { someOtherData: "blah"});
     * 	}
     * }
     *
     * // Example subscribe hook:
     * function subscribeCallback(error, subscribe) {
     * 	if (subscribe) {
     * 		// This function must be called to accept or reject the subscription. Send an error code as the first parameter
     * 		// to reject. Send null as the first parameter to accept. Once accepted, the subscriber will receive
     * 		// the current topic's state unless the second parameter is provided which will override what is sent
     * 		// to the subscriber (but not override the topic's actual internal state).
     * 		subscribe.sendNotifyToSubscriber(null, { "NOTIFICATION-STATE": "One" });
     * 	}
     * }
     *
     * // Example unsubscribe hook:
     * function unsubscribeCallback(error, unsubscribe) {
     * 	if (unsubscribe) {
     * 		// This function must be called to accept or reject the unsubscription. Send null (or nothing) as the first
     * 		// parameter to accept the unsubscription. Send an error code to reject it.
     * 		unsubscribe.removeSubscriber(null);
     * 	}
     * }
     *
     */
    addPubSubResponder: <T_2 = any>(topic: string | RegExp, initialState?: object | undefined, params?: {
        subscribeCallback?: SubscribeCallback<T_2> | undefined;
        unsubscribeCallback?: UnsubscribeCallback | undefined;
        publishCallback?: PublishCallback<T_2> | undefined;
    } | undefined, callback?: ((err?: string | Error | undefined, result?: "success" | undefined) => void) | undefined) => void;
    /**
     * Removes a PubSub responder from the specified topic. Only locally created responders (i.e. created in the local window) can be removed.
     *
     * See <code>addPubSubResponder</code> for corresponding addition of a PubSub responder.
     *
     * @param {string} topic Unique topic for responder being removed (may be RegEx, but if so much be exact RegEx used previously with <code>addPubSubResponder</code>).
     *
     * @example
     *
     * FSBL.Clients.RouterClient.removePubSubResponder("topicABC");
     *
     */
    removePubSubResponder: (topic: string | RegExp) => void;
    /**
     * Subscribe to a PubSub responder. Each responder topic can have many subscribers (local in this window or remote in other windows). Each subscriber immediately (but asynchronously) receives back current state in a notify; new notifications are received for each publish sent to the same topic.
     *
     * See <code>addPubSubResponder</code> for corresponding addition of a PubSub responder to handle the subscribe. See [publish]{@link RouterClient#publish} for how to publish data to subscribers.
     *
     * @param {string} topic A unique string representing the topic being subscribed to.
     * @param {function} notifyCallback Invoked on immediately upon subscription, then again on each incoming notification for the specified topic.
     * @returns {object} An object containing a unique id representing the subscription. This can be used later to unsubscribe.
     *
     * @example
     *
     * var subscribeId = RouterClient.subscribe("topicABC", function(err, notify) {
     *	if (!err) {
     *		var notificationStateData = notify.data;
     *		// do something with notify data
     *	}
     * });
     *
     *
     */
    subscribe: <T_3 = any>(topic: string, notifyCallback: (err: StandardError, response: SubscriberResponse<T_3>) => void) => {
        subscribeID: string;
        topic: string;
    };
    /**
     * Publish to a PubSub Responder, which will trigger a corresponding notification to all subscribers (local in this window or remote in other windows). There may be multiple publishers for a topic (again, in same window or remote windows).
     *
     * See <code>addPubSubResponder</code> for corresponding addition of a PubSub publisher (i.e., sending notifications to all subscriber). See <code>Subscribe</code> for corresponding subscription published results (in the form of a <code>Notify</code> event).
     *
     * @param {string} topic A unique string representing the topic being published.
     * @param {object} event The topic state to be published to all subscribers (unless the PubSub responder optionally modifies in between).
     *
     * @example
     *
     * FSBL.Clients.RouterClient.publish("topicABC", topicState);
     *
     */
    publish: <T_4 = any>(topic: string, event: T_4) => void;
    /**
     * Unsubscribes from a PubSub responder so no more notifications are received (but doesn't affect other subscriptions). Only works from the window the PubSub responder was created in.
     *
     * See <code>subscribe</code> for corresponding subscription being removed.
     *
     * @param {object} subscribeIDStruct
     * @param {string} subscribeIDStruct.subscribeID The id returned from the corresponding subscription to the topic.
     * @param {string} subscribeIDStruct.topic The topic for the subscription.
     *
     * @example
     *
     * FSBL.Clients.RouterClient.unsubscribe(subscribeId);
     *
     */
    unsubscribe: (subscribeIDStruct: {
        subscribeID: string;
        topic: string;
    }) => void;
    /**
     * Tests an incoming Router message to see if it originated from the same origin (i.e., a trusted source; not cross-domain).
     *
     * Currently, the origin of an incoming Router message is determined by way of the SharedWorker transport. By definition, SharedWorkers do not work across domains.
     * This means any message coming in over the transport will not be trusted. However, by default, all same-origin components
     * and services connect to the Router using a SharedWorker transport.
     * @param {object} incomingMessage An incoming Router message (e.g., transmit, query, notification) to test to see if trusted.
     *
     * @example
     * FSBL.Clients.RouterClient.trustedMessage(incomingRouterMessage);
     */
    trustedMessage: (incomingMessage: RouterMessage) => boolean;
    /**
     * Removes all listeners, responders, and subscribers for this router client -- automatically called when the client is shutting down. Can be called multiple times.
     */
    disconnectAll: () => void;
    /**
     * Used internally by Logger client
     * @private
     */
    calibrateTimeWithRouterService(callback: (offset: number) => void): void;
};
export declare type IRouterClient = typeof RouterClient;
export default RouterClient;
//# sourceMappingURL=routerClientInstance.d.ts.map