Event types for the InterApplicationBus.
The subscriber-added and subscriber-removed events are disabled by default.
To re-enable them, launch the runtime with the --emit-legacy-iab-events flag.
These events will be removed in a future version. Use Channel for connection
lifecycle management instead.
Use Channel onConnection / onDisconnection instead.
Publishes a message to all applications running on OpenFin Runtime that are subscribed to the specified topic.
The topic on which the message is sent
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
Sends a message to a specific application on a specific topic.
The identity of the application to which the message is sent
The topic on which the message is sent
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
Subscribes to messages from the specified application on the specified topic.
This object is described in the Identity in the typedef
The topic on which the message is sent
A function that is called when a message has been received. It is passed
two arguments: the message, and the identity ({ uuid, name }) of the sender.
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
This differs from the legacy fin.desktop.InterApplicationBus.subscribe API,
which passes (message, uuid, name) as separate arguments.
// subscribe to a specified application
fin.InterApplicationBus.subscribe(fin.me, 'topic', (message, sender) => {
console.log(`Received from ${sender.uuid}/${sender.name}:`, message);
}).then(() => console.log('Subscribed to the specified application')).catch(err => console.log(err));
// subscribe to wildcard
fin.InterApplicationBus.subscribe({ uuid: '*' }, 'topic', sub_msg => console.log(sub_msg)).then(() => console.log('Subscribed to *')).catch(err => console.log(err));
Unsubscribes to messages from the specified application on the specified topic.
This object is described in the Identity in the typedef
The topic on which the message is sent
A callback previously registered with subscribe()
If you are listening to all apps on a topic, (i.e you passed { uuid:'*' } to the subscribe function)
then you need to pass { uuid:'*' } to unsubscribe as well. If you are listening to a specific application,
(i.e you passed { uuid:'some_app' } to the subscribe function) then you need to provide the same identifier to
unsubscribe, unsubscribing to * on that same topic will not unhook your initial listener otherwise.
const listener = console.log;
// If any application publishes a message on topic `foo`, our listener will be called.
await fin.InterApplicationBus.subscribe({ uuid:'*' }, 'foo', listener)
// When you want to unsubscribe, you need to specify the uuid of the app you'd like to
// unsubscribe from (or `*`) and provide the same function you gave the subscribe function
await fin.InterApplicationBus.unsubscribe({ uuid:'*' }, 'foo', listener)
A messaging bus that allows for pub/sub messaging between different applications.