Methods
publish(topic, message) → {Promise.<void>}
Publishes a message to all applications running on OpenFin Runtime that are subscribed to the specified topic.
Parameters:
Name | Type | Description |
---|---|---|
topic |
string | The topic on which the message is sent |
message |
any | 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 |
- Tutorials:
Returns:
- Type
- Promise.<void>
send(destination, topic, message) → {Promise.<void>}
Sends a message to a specific application on a specific topic.
Parameters:
Name | Type | Description |
---|---|---|
destination |
object | The uuid of the application to which the message is sent |
topic |
string | The topic on which the message is sent |
message |
any | 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 |
- Tutorials:
Returns:
- Type
- Promise.<void>
subscribe(source, topic, listener) → {Promise.<void>}
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 | Description |
---|---|---|
source |
Identity | This object is described in the Identity in the typedef |
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 |
- Tutorials:
Returns:
- Type
- Promise.<void>
unsubscribe(source, topic, listener) → {Promise.<void>}
Unsubscribes to messages from the specified application on the specified topic.
Parameters:
Name | Type | Description |
---|---|---|
source |
Identity | This object is described in the Identity in the typedef |
topic |
string | The topic on which the message is sent |
listener |
function | A callback previously registered with subscribe() |
- Tutorials:
Returns:
- Type
- Promise.<void>