Namespace: Channel

InterApplicationBus. Channel

The Channel namespace allows an OpenFin application to create a channel as a ChannelProvider, or connect to a channel as a ChannelClient. 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.

Asynchronous Methods

Methods

(static) connect(channelName, options) → {Promise.<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. EXPERIMENTAL: pass { protocols: ['rtc'] } as options to opt-in to High Throughput Channels.

Parameters:
Name Type Description
channelName string

Name of the target channel.

options InterApplicationBus.Channel~ChannelConnectOptions

Connection options.

Tutorials:
Returns:

Returns promise that resolves with an instance of ChannelClient.

Type
Promise.<Channel#ChannelClient>

(static) create(channelName, options) → {Promise.<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. EXPERIMENTAL: pass { protocols: ['rtc'] } as options to opt-in to High Throughput Channels.

Parameters:
Name Type Description
channelName string

Name of the channel to be created.

options InterApplicationBus.Channel~ChannelCreateOptions

Creation options.

Tutorials:
Returns:

Returns promise that resolves with an instance of ChannelProvider.

Type
Promise.<Channel#ChannelProvider>

(static) onChannelConnect(listener) → {Promise.<void>}

Listens for channel connections.

Parameters:
Name Type Description
listener InterApplicationBus.Channel~ConnectionEvent

callback to execute.

Tutorials:
Returns:
Type
Promise.<void>

(static) onChannelDisconnect(listener) → {Promise.<void>}

Listen for channel disconnections.

Parameters:
Name Type Description
listener InterApplicationBus.Channel~ConnectionEvent

callback to execute.

Tutorials:
Returns:
Type
Promise.<void>

Type Definitions

ChannelConnectOptions

Options provided on a client connection to a channel.

Type:
  • object
Properties:
Name Type Attributes Default Description
protocols Array.<InterApplicationBus.Channel~MessagingProtocols> <optional>
['classic']

EXPERIMENTAL: Messaging protocols requested by the client, connection will fail if the provider protocols are not compatible.

payload any <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.

ChannelCreateOptions

Channel provider creation options.

Type:
  • object
Properties:
Name Type Attributes Default Description
protocols Array.<InterApplicationBus.Channel~MessagingProtocols> <optional>
['classic']

EXPERIMENTAL: Messaging protocols supported by the channel provider.

ClientIdentity

Client Identity.

Type:
  • object
Properties:
Name Type Description
uuid string

Channel client uuid.

name string

Channel client name.

endpointId string

Unique identifier for a client, because there can be multiple clients at one name/uuid entity.

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.

MessagingProtocols

Protocol values for determining channel messaging strategy.

Type:
  • 'classic' | 'rtc'

ProviderIdentity

Provider Identity.

Type:
  • object
Properties:
Name Type Attributes Description
uuid string

Channel provider uuid.

name string <optional>

Channel provider name.

channelId string

Identifier of the channel.

isExternal boolean <optional>

true if it's external connection.

channelName string

Name of the channel.