Interoperability in OpenFin Workspace
How to easily enable interoperability in OpenFin Workspace
Deploying your application as a View in OpenFin Workspace enables seamless interoperability between discrete applications connected to the Workspace through Workspace Views.
Multiple Workspace views can share information as contexts when the end-user chooses to link them together. With only a few intuitive clicks and no additional configuration or custom code required for your application, it can begin to “talk” with neighboring applications. The link can even work without a network connection. We call this interoperable link context sharing.
Context sharing is supported through the OpenFin Container’s Interop API. Contexts can be shared only among Workspace views within the same context groups. Context groups are created when the end-user interacts with Workspace views to explicitly link them together.
All that you must do now is decide in what ways your application utilizes the context information it can now access.
How it works
The OpenFin Workspace supports up to six context groups through the feature color linking.
The end-user can color-code Workspace views, grouping them together through the defined set of colors. For example, all of the views set as "blue" can now share the same context information. The end-user can then save the color linking as part of their workspace, to use or share with other end-users at a later time.
Configuring interoperability in your application
Prerequisites
Before you can configure interoperability into your application to, check out Set up Your Dev Environment to ensure you have everything that you need.
Available context types
contact
contactList
country
instrument
instrumentList
organization
portfolio
position
Read more about context types in the FDC3 API reference
Receiving contexts in your application
In your application’s code, define a listener using fin.me.interop.addContextHandler:
import { fin } from '@openfin/core'
function handleInstrumentContext(contextInfo) {
const { type, id } = contextInfo;
console.log('contextInfo for instrument', contextInfo)
}
function handleCountryContext(contextInfo) {
const { type, id } = contextInfo;
console.log('contextInfo for country', contextInfo)
}
fin.me.interop.addContextHandler(handleInstrumentContext, 'instrument')
fin.me.interop.addContextHandler(handleCountryContext, 'country')
Sending contexts from your application
In your application's code, define an emitter using fin.me.interop.setContext:
setInstrumentContext = async (ticker) => {
fin.me.interop.setContext({
type: 'instrument',
id: { ticker }
});
}
// The end-user clicks on an instrument of interest.
// The application sets that instrument Context informing other applications within the Context Group
element.on('click', (evt) => {
setInstrumentContext(evt.ticker)
})
Updated 6 months ago