OpenFin FDC3 platform development
In the past, people developing platforms had to create and connect to a DesktopAgent, manage channels, and perform other tasks to meet the FDC3 standard. OpenFin simplifies FDC3 platform development by providing a built-in DesktopAgent (called the Interop Broker) which provides built-in System Channel and App Channel management.
An OpenFin platform comes with an out-of-the-box Interop Broker which handles cross-app communication for you. This simplifies the paradigm for platform developers, letting you focus on the code that delivers benefits to your users.
Using your own channel management system
You have the option to write your own channel management system. This can be implemented by using another set of two APIs, specifically in your default platform window (not the Interop Broker):
You need to provide your own UI to show the channels and allow their selection, but these two APIs will control the logic that executes when the user clicks your controls.
Intent handling for platform developers
Just like application developers, platform developers need to know only two primary APIs to handle intents, but there’s a bit more work to do behind the scenes.
Your platform will already have an Interop Broker up and running, and it handles much of the work for you. The work you need to do is in these two functions:
InteropBroker.handleFiredIntent
: Responsible for the launching of applications that are able to handle a given intent. Must be overridden.InteropBroker.setIntentTarget
: Should be called in InteropBroker.handleFiredIntent. While handleFiredIntent is responsible for launching applications, setIntentTarget is used to tell the InteropBroker which application should receive the intent when it is ready.
As a platform developer you only need to do two things:
- Override the handleFiredIntent function to launch a view and keep track of its identity.
- Call setIntentTarget with that view’s identity to tell the Interop Broker to give the intent to this view.
To explain this in a bit more detail::
- The Interop Broker receives the call from the view to raise an intent (fdc3.raiseIntent).
- The Interop Broker calls InteropBroker.handleFiredIntent.
As a platform developer, you override the InteropBroker.handleFiredIntent function. In the handleFiredIntent function, you receive the intent from the app, and take action based on that intent.
For example, if you receive an fdc3.instrument and a ViewChart intent, your code can collect a list of apps that can respond to ViewChart intent. - Your handleFiredIntent code will then select an app to view the chart. How you choose to do this is your choice. If you have only one chart viewing app, you might just select just that app. If you have many apps that can view a chart, you might prompt the user to choose among the available apps which can view charts.
- Your handleFiredIntent then creates a view for the selected app, and keeps track of that view.
- By calling the InteropBroker.setIntentTarget function with the identity of the view that was just launched, you will inform Interop Broker which view to use to view the chart.
- The new ViewChart view will call fdc3.addIntentListener to register a listener function for receiving intents.
- Interop Broker will then pass the intent to the ViewChart view’s listener function after the view is up and ready to receive intents.
Full FDC3 Compliance for Intents
OpenFin supports 100% API compliance with the FDC3 spec for intents. The following methods are available:
fdc3.findIntent
fdc3.findIntent
Used when:
-
The platform knows which intent to fire but doesn’t know which app to fire it to.
-
When an app wants to choose the intent handler, not the platform.
The fdc3.findIntent method returns a AppIntent
promise which contains
-
Metadata about the intent.
-
An array of apps that can handle the intent.
findIntent(intent: string, context?: Context): Promise<AppIntent>; // returns a single AppIntent: // { // intent: { name: "StartChat", displayName: "Chat" }, // apps: [{ name: "Skype" }, { name: "Symphony" }, { name: "Slack" }] // }
fdc3.findIntentsByContext
fdc3.findIntentsByContext
Used when:
-
The platform knows which context to raise an intent for, but doesn’t know what intents are supported for that context, or which app to target.
-
The platform can raise an intent with only the context and you want the InteropBroker / DesktopAgent to display a UI choice to the user to resolve it.
-
The platform can display a UI to let the user choose the intent and app to resolve it.
The fdc3.findIntentsByContext method also returns a AppIntent
promise which is described above.
fdc3.raiseIntentForContext
Used when:
- The platform only has a context, and you want the user or InteropBroker / DesktopAgent to choose the intent and app to resolve with that context.
If a user passes an application to target, that is passed to the InteropBroker / DesktopAgent. If the InteropBroker / DesktopAgent supports targeted intents, it’s up to the InteropBroker / DesktopAgent to resolve to that app.
Updated 10 months ago