///
import { EventEmitter } from 'events';
import { Base } from '../base';
import { Transport, Message } from '../../transport/transport';
import { Channel } from './channel/index';
/**
* A messaging bus that allows for pub/sub messaging between different applications.
* @namespace
*/
export default class InterApplicationBus extends Base {
Channel: Channel;
events: {
subscriberAdded: string;
subscriberRemoved: string;
};
private refCounter;
protected emitter: EventEmitter;
on: any;
removeAllListeners: any;
constructor(wire: Transport);
/**
* Publishes a message to all applications running on OpenFin Runtime that
* are subscribed to the specified topic.
* @param { string } topic The topic on which the message is sent
* @param { any } message The message to be published. Can be either a primitive
* data type (string, number, or boolean) or composite data type (object, array)
* that is composed of other primitive or composite data types
* @return {Promise.}
* @tutorial InterApplicationBus.publish
*/
publish(topic: string, message: any): Promise;
/**
* Sends a message to a specific application on a specific topic.
* @param { Identity } destination The identity of the application to which the message is sent
* @param { string } topic The topic on which the message is sent
* @param { any } message The message to be sent. Can be either a primitive data
* type (string, number, or boolean) or composite data type (object, array) that
* is composed of other primitive or composite data types
* @return {Promise.}
* @tutorial InterApplicationBus.send
*/
send(destination: {
uuid: string;
name?: string;
}, topic: string, message: any): Promise;
/**
* Subscribes to messages from the specified application on the specified topic.
* @param { Identity } source This object is described in the Identity in the typedef
* @param { string } topic The topic on which the message is sent
* @param { function } listener A function that is called when a message has
* been received. It is passed the message, uuid and name of the sending application.
* The message can be either a primitive data type (string, number, or boolean) or
* composite data type (object, array) that is composed of other primitive or composite
* data types
* @return {Promise.}
* @tutorial InterApplicationBus.subscribe
*/
subscribe(source: {
uuid: string;
name?: string;
}, topic: string, listener: any): Promise;
/**
* Unsubscribes to messages from the specified application on the specified topic.
* @param { Identity } source This object is described in the Identity in the typedef
* @param { string } topic The topic on which the message is sent
* @param { function } listener A callback previously registered with subscribe()
* @return {Promise.}
* @tutorial InterApplicationBus.unsubscribe
*/
unsubscribe(source: {
uuid: string;
name?: string;
}, topic: string, listener: any): Promise;
private processMessage;
private emitSubscriverEvent;
protected createSubscriptionKey(uuid: string, name: string, topic: string): string;
protected onmessage(message: Message): boolean;
}
export declare class InterAppPayload {
sourceUuid: string;
sourceWindowName: string;
topic: string;
destinationUuid?: string;
message?: any;
}