The Channel namespace allows an OpenFin application to create a channel as a ChannelProvider,
or connect to a channel as a ChannelClient (see Classes below). The "handshake" between the communication partners is
simplified when using a channel. A request to connect to a channel as a client will return a promise that resolves if/when the channel has been created. Both the
provider and client can dispatch actions that have been registered on their opposites, and dispatch returns a promise that resolves with a payload from the other
communication participant. There can be only one provider per channel, but many clients. Version 9.61.35.*
or later is required for both communication partners.
Synchronous Methods
Asynchronous Methods
Classes
Methods
(static) connect(channelName, options) → {Promise.<fin.desktop.InterApplicationBus.Channel#ChannelClient>}
Connect to a channel. Returns a promise for a ChannelClient instance for that channel. If you wish to send a payload to the provider, add a payload property to the options argument.
Parameters:
Name | Type | Description |
---|---|---|
channelName |
string | Name of the target channel. |
options |
fin.desktop.InterApplicationBus.Channel~ChannelConnectOptions | Connection options. |
- Tutorials:
Returns:
Returns promise that resolves with an instance of ChannelClient.
- Type
- Promise.<fin.desktop.InterApplicationBus.Channel#ChannelClient>
(static) create(channelName) → {Promise.<fin.desktop.InterApplicationBus.Channel#ChannelProvider>}
Create a new channel. Returns a promise that resolves with a ChannelProvider instance for your channel. You must provide a unique channelName. If a channelName is not provided, or it is not unique, the creation will fail.
Parameters:
Name | Type | Description |
---|---|---|
channelName |
string | Name of the channel to be created. |
- Tutorials:
Returns:
Returns promise that resolves with an instance of ChannelProvider.
- Type
- Promise.<fin.desktop.InterApplicationBus.Channel#ChannelProvider>
(static) onChannelConnect(listener)
Listen for newly created channels.
Parameters:
Name | Type | Description |
---|---|---|
listener |
fin.desktop.InterApplicationBus.Channel~ConnectionEvent | callback to execute. |
- Tutorials:
(static) onChannelDisconnect(listener)
Listen for channel disconnections.
Parameters:
Name | Type | Description |
---|---|---|
listener |
fin.desktop.InterApplicationBus.Channel~ConnectionEvent | callback to execute. |
- Tutorials:
Type Definitions
ConnectionEvent
Callback for onChannelConnect or onChannelDisconnect.
Type:
- object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
channelId |
string | Identifier of the channel. |
|
uuid |
string | Channel provider uuid. |
|
name |
string |
<optional> |
Channel provider name. |
channelName |
string | Name of the channel. |
ConnectOptions
Type:
- object
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
payload |
* |
<optional> |
Payload to pass to ChannelProvider onConnection action. |
|
wait |
boolean |
<optional> |
true | If true will wait for ChannelProvider to connect. If false will fail if ChannelProvider is not found. |