A messaging bus that allows for pub/sub messaging between different applications.
Synchronous Methods
- addSubscribeListener(listener)
- addUnsubscribeListener(listener)
- removeSubscribeListener(listener)
- removeUnsubscribeListener(listener)
Asynchronous Methods
- publish(topic, message, callback, errorCallback)
- send(destinationUuid, name, topic, message, callback, errorCallback)
- subscribe(senderUuid, name, topic, listener, callback, errorCallback)
- unsubscribe(senderUuid, name, topic, listener, callback, errorCallback)
NOTE: All the above listed methods are both instance methods and shared methods of this singleton object.
Methods
(static) addSubscribeListener(listener)
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:
(static) addUnsubscribeListener(listener)
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:
(static) publish(topic, message, callbackopt, errorCallbackopt)
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 |
* | 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:
(static) removeSubscribeListener(listener)
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. |
(static) removeUnsubscribeListener(listener)
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. |
(static) send(destinationUuid, nameopt, topic, message, callbackopt, errorCallbackopt)
Sends a message to a specific application on a specific topic.
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 |
* | 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:
(static) subscribe(senderUuid, nameopt, topic, listener, callbackopt, errorCallbackopt)
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, 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. |
|
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:
(static) unsubscribe(senderUuid, nameopt, topic, listener, callbackopt, errorCallbackopt)
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: