A messaging bus that allows for pub/sub messaging between different applications.
Method Index
Synchronous
- addSubscribeListener(listener)
- addUnsubscribeListener(listener)
- publish(topic, message)
- removeSubscribeListener(listener)
- removeUnsubscribeListener(listener)
- send(destinationUuid, [name],topic, message)
Asynchronous
Methods
(static) addSubscribeListener(listener) → {undefined}
Adds a listener that gets called when applications subscribe to the current application's messages.
Parameters:
Name | Type | Description |
---|---|---|
listener |
function | A function that is called whenever an application subscribes to its messages. The UUID of the subscribing application and the topic of the message are passed. |
- Tutorials:
Returns:
- Type
- undefined
(static) addUnsubscribeListener(listener) → {undefined}
Adds a listener that gets called when applications unsubscribe to the current application's messages.
Parameters:
Name | Type | Description |
---|---|---|
listener |
function | A function that is called whenever an application subscribes to its messages. The UUID of the subscribing application and the topic of the message are passed. |
- Tutorials:
Returns:
- Type
- undefined
(static) publish(topic, message, callbackopt, errorCallbackopt) → {undefined}
Publishes a message to all applications running on OpenFin Runtime that are subscribed to the specified topic.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
topic |
string | The topic on which the message is sent. |
|
message |
various | 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. |
|
callback |
function |
<optional> |
called if the method succeeds. |
errorCallback |
function |
<optional> |
called if the method fails. The reason for failure is passed as an argument. |
- Tutorials:
Returns:
- Type
- undefined
(static) removeSubscribeListener(listener) → {undefined}
Removes a previously registered subscribe listener.
Parameters:
Name | Type | Description |
---|---|---|
listener |
function | A function that is called whenever an application subscribes to its messages. The UUID of the subscribing application and the topic of the message are passed. |
Returns:
- Type
- undefined
(static) removeUnsubscribeListener(listener) → {undefined}
Removes a previously registered unsubscribe listener.
Parameters:
Name | Type | Description |
---|---|---|
listener |
function | A function that is called whenever an application unsubscribes to its messages. The UUID of the unsubscribing application and the topic of the message are passed. |
Returns:
- Type
- undefined
(static) send(destinationUuid, nameopt, topic, message, callbackopt, errorCallbackopt) → {undefined}
Sends a message to a specific application on a specific topic.
Note that as of version 5.44.8.29
this call optionally can take a different
signature that enables cache control. The updated signature is as follows
fin.desktop.InterApplicationBus.send({
uuid: 'some-uuid',
message: 'this will cache until someone subscribes to it',
topic: 'apply topically',
cache: 'until-delivered'
},
function(){console.log('worked')},
function(){console.log("D'oh")});
Sending in this way will cache the message (up to 20, FIFO) if there are no active subscriptions to your specific uuid, [name], topic combination until it is subscribed to and delivered.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
destinationUuid |
string | The uuid of the application to which the message is sent. |
|
name |
string |
<optional> |
The name of the application window to which the message is sent. |
topic |
string | The topic on which the message is sent. |
|
message |
various | 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. |
|
callback |
function |
<optional> |
called if the method succeeds. |
errorCallback |
function |
<optional> |
called if the method fails. The reason for failure is passed as an argument. |
- Tutorials:
Returns:
- Type
- undefined
(static) subscribe(senderUuid, nameopt, topic, listener, callbackopt, errorCallbackopt) → {undefined}
Subscribes to messages from the specified application on the specified topic. If the subscription is for a uuid, [name], topic combination that has already been published to upon subscription you will receive the last 20 missed messages in the order they were published.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
senderUuid |
string | The UUID of the application to which to subscribe. The wildcard "*" can be used to receive messages from all applications. |
|
name |
string |
<optional> |
The name of the application window to which the message is sent. |
topic |
string | The topic on which the message is sent. |
|
listener |
function | A function that is called when a message has been received. It is passed the message and the uuid 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. |
|
callback |
function |
<optional> |
called if the method succeeds. |
errorCallback |
function |
<optional> |
called if the method fails. The reason for failure is passed as an argument. |
- Tutorials:
Returns:
- Type
- undefined
(static) unsubscribe(senderUuid, nameopt, topic, listener, callbackopt, errorCallbackopt) → {undefined}
Unsubscribes to messages from the specified application on the specified topic.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
senderUuid |
string | The UUID of the application to which to unsubscribe. |
|
name |
string |
<optional> |
The name of the application window to which the message is sent. |
topic |
string | The topic on which the message is sent. |
|
listener |
function | A callback previously registered with subscribe(). |
|
callback |
function |
<optional> |
called if the method succeeds. |
errorCallback |
function |
<optional> |
called if the method fails. The reason for failure is passed as an argument. |
- Tutorials:
Returns:
- Type
- undefined