WarningLegacy version 5 documentation. View current documentation.

Linking

The Linker API is deprecated as of version 6.0. Please see the Interop Tutorial for data integration.

The Linker allows two components to share and synchronize data. By using the Linker, you can empower end users to create and destroy linkages at run time.

Frequently, end users will have separate components that they want to stay in sync. A typical capital markets use case would be wanting to link several components together so that all components would share the same stock symbol: changing the stock symbol in one component would cause the other components to also change their symbol.

Using the Linker

To add the Linker icon to a component add foreign['Window Manager'].showLinker = true to its component config.

The image below shows the Linker icon along with the channels that this component has joined. Channels are demarcated by colors and numbers—this component is in both group 1 (purple) and group 3 (green). Channels are added or removed when a user clicks on a channel in the Linker window.

By default, if a component joins a channel, it will receive all messages for that channel.

Linker

Registering components

Components must register themselves as linkable and specify linkage types. This registration and communication between components occurs automatically over the Finsemble Router via FSBL.Clients.LinkerClient. The Linker Client handles interfacing with the Router so that you can focus on passing and receiving linked information.

Links are unique to the channel and data type. Linkages are saved in the component's state.

Publish

To transmit data to other components, simply call FSBL.Clients.LinkerClient.publish whenever you want to send out an update. This will transmit the given data to all channels that the current component has joined.

FSBL.Clients.LinkerClient.publish({
	dataType: "symbol",
	data: "AAPL",
});
//To send data through the linker.This will send a `symbol` object with the symbol 'AAPL` to
//any components that is in the same channel that is listening for `symbol`

Subscribe

To receive data from other components through the Linker Client, you'll need to subscribe to a specific topic.

FSBL.Clients.LinkerClient.subscribe("symbol", function (data) {
	// Symbol is the data type
	//Do something with data. Data would be "AAPL" in this case.
});

Changing the Linker's defaults

It is not necessary to stick to our channel conventions. Our default implementation represents channels by color. However, channels are simple strings and so can be anything. When a component is assigned to the purple channel, publish and subscribe messages are only received by other components assigned to that channel. If you're using Finsemble's built-in Linker component, you won't have to code this. The Linker component does the work of assigning and un-assigning its associated component to the selected channel. However, the Linker API exposes functionality so that you can manage channels programmatically if you choose. You could use these functions to build your own Linker component using a different paradigm, or intelligently link components based on your own business logic.

Changing a channel's color scheme

You can override the default coloration of the Linker channels using configuration. In finsemble.servicesConfig.linker.channels, set different colors using this method:

{
	name: "group1",
	color: "#8781BD",
	border: "#797381"
},
{
	name: "group2",
	color: "#FFE035",
	border: "#FFD803"
}
etc.

Setting Linker channels at spawn

You can automatically set a component to spawn subscribed to a particular channel by using the following code:

FSBL.Clients.LauncherClient.spawn(
 "Welcome Component",
 { addToWorkspace: true, data: { linker: { channels: ["group1"] } } },cb
);

check   The Linker allows end users to keep two or more components in sync. You must program the components to publish and subscribe the type of data that may be synced.
 

Further reading

Advanced information about linking can be found in the Linker Client documentation.

The Linker Client automatically shares data between windows based on linkage. A user can also use the Drag and Drop Client to share data. Check out Drag and Drop Sharing for more information.

See the FDC3 project for an emerging industry standard taxonomy.