Skip to main content

Module: LinkerClient

Deprecated: Linker Client (Finsemble Workspaces)

The Linker API has been DEPRECATED. Please use FDC3 interop which provides an industry standard API for exchanging context between apps, including channel linking.

The Linker API allows components to synchronize on a piece of data. For instance, an end user can use the Linker to link multiple components by stock symbol. Use the Linker API to enable your components to participate in this synchronization.

In order for components to be linked, the components must understand the data format that will be passed between them (the "context"), and agree on a label that identifies that format (the dataType). For instance, components might choose to publish and subscribe to a dataType called "symbol". They would then also need to agree what a "symbol" looks like, for instance, {symbol: "IBM"}. The Linker API doesn't proscribe any specific format for context or set of labels.

Behind the scenes, the Linker Service coordinates Linker activity between components. It keeps track of the available channels and channel assignments. It uses a dedicated store (the Distributed Store) to maintain this information and also persists the information to workspaces (Workspace Client).

The Linker Client frequently uses the parameters windowIdentifier and componentType. Learn more about them here.

For more information, see the Linking tutorial.

Methods

createChannel

Private createChannel(params, cb): any

deprecated The LinkerClient has been deprecated.

Create a new Linker channel. This channel will be available globally.

LinkerClient.createChannel({name: "red", color: "#ff0000", border: "#ffffff"}, callback)

Parameters

NameTypeDescription
paramslinkerGroup
cbFunctionOptional. Callback to retrieve returned results asynchronously.

Returns

any

Returns an array of all available channels


getAllChannels

getAllChannels(cb?): any

deprecated The LinkerClient has been deprecated.

Returns all available Linker channels.

let groups = FSBL.Clients.LinkerClient.getAllChannels();
FSBL.Clients.LinkerClient.getAllChannels((err, channels) => { ... });

Parameters

NameTypeDescription
cb?FunctionOptional. Callback to retrieve returned results asynchronously.

Returns

any

An array of all channels. Each array item is {name:channelName} plus any other optional fields such as color.


getLinkedComponents

getLinkedComponents(params, cb?): any

deprecated The LinkerClient has been deprecated.

Retrieves an array of all components with links that match the given parameters. If no parameters are specified, all windows with established links will be returned.

Get all components linked to a given component:

FSBL.Clients.LinkerClient.getLinkedComponents({ windowIdentifier: wi });

Get all components linked to channel "group 1":

FSBL.Clients.LinkerClient.getLinkedComponents({ channels: ['group1'] });
// Response format: [{windowName: 'Window Name', componentType: 'Component Type', uuid: 'uuid', channels: ['group1'] }]

Parameters

NameTypeDescription
paramsObjectOptional
params.channels?string[]Restrict to these channels.
params.componentTypes?string[]Restrict to these componentTypes. The componentType is a key in the finsemble.components configuration object.
params.windowIdentifier?WindowIdentifierRestrict to this component.
cb?StandardCallback<StandardError, any>Optional. Callback to retrieve returned results asynchronously.

Returns

any

An array of linked components, their windows, and their linked channels.


getLinkedWindows

getLinkedWindows(params?, cb?): any

deprecated The LinkerClient has been deprecated.

Retrieves an array of all components with links that match the given parameters. If no parameters are specified, all windows with established links will be returned.

Get all components linked to a given component:

FSBL.Clients.LinkerClient.getLinkedWindows({windowIdentifier: wi});

Get all Windows linked to channel "group1":

FSBL.Clients.LinkerClient.getLinkedComponents({ channels: ['group1'] });
// Response format: [{ windowName: 'Window Name', componentType: 'Component Type', uuid: 'uuid', channels: ['group1'] }]

Parameters

NameTypeDescription
params?ObjectOptional
params.channels?string[]Restrict to these channels.
params.client?anyAlias for windowIdentifier.
params.componentTypes?string[]Restrict to these componentTypes. The componentType is a key in the finsemble.components configuration object.
params.groups?string[]Alias for channels.
params.windowIdentifier?WindowIdentifierRestrict to this component.
cb?StandardCallback<StandardError, any>Optional. Callback to retrieve returned results asynchronously.

Returns

any

An array of linked components, their windows, and their linked channels.


linkToChannel

linkToChannel(channel, windowIdentifier?, cb?): any

deprecated The LinkerClient has been deprecated.

Add a component to a Linker channel programmatically. Components will begin receiving any new contexts published to this channel but will not receive the currently established context.

FSBL.Clients.LinkerClient.linkToChannel("group3", null); // Link current window to channel.
FSBL.Clients.LinkerClient.linkToChannel("group3", windowIdentifier); // Link the requested window to channel.

Parameters

NameTypeDescription
channelstring | string[]The name of the channel to link our component to, or an array of names.
windowIdentifier?WindowIdentifierOptional. windowIdentifier for the component. If null, it defaults to the current window.
cb?FunctionOptional. Callback to retrieve returned results asynchronously.

Returns

any

The new state: linked channels, all channels


onStateChange

onStateChange(cb): void

deprecated The LinkerClient has been deprecated.

Use this method to register a callback which will be called whenever the state of the Linker changes. This will be called whenever a user links or unlinks your component to a channel.

FSBL.Clients.LinkerClient.onStateChange(function(err, response){
if(response.channels){
console.log("Printout of channel status ", response.channels);
}
});

Parameters

NameTypeDescription
cbStandardCallback<StandardError, any>returns { null, LinkerClient~state }

Returns

void


openLinkerWindow

openLinkerWindow(cb): void

deprecated The LinkerClient has been deprecated.

Opens the Linker window.

Parameters

NameTypeDescription
cbanyThe callback to be invoked after the method completes successfully.

Returns

void


publish

publish(params, cb): any

deprecated The LinkerClient has been deprecated.

Publish a piece of data. The data will be published to all channels that the component is linked to. Foreign components that are linked to those channels will receive the data if they have subscribed to this dataType. They can then use that data to synchronize their internal state. See LinkerClient.subscribe().

FSBL.Clients.LinkerClient.publish({ dataType:"symbol", data:"AAPL" })

Parameters

NameTypeDescription
paramsObject-
params.channels?string[]Optional. Specifies which channels publish this piece of data. This overrides the default which is to publish to all linked channels.
params.dataanyThe data ("context") being transmitted.
params.dataTypestringA string representing the data type being sent.
cbStandardCallback<StandardError, any>Optional. Callback to retrieve returned results asynchronously.

Returns

any


removeChannel

Private removeChannel(name, cb): any

Remove a Linker channel. It will be removed globally. Any component that is currently assigned to this channel will be unassigned.

FSBL.Clients.LinkerClient.removeChannel("group1")

Parameters

NameTypeDescription
namestringThe name of the channel to remove
cbFunctionOptional. Callback to retrieve returned results asynchronously

Returns

any

Returns an array of available channels


subscribe

subscribe(dataType, listener): void

deprecated The LinkerClient has been deprecated.

Registers a client for a specific data type that is sent to a channel. Calling subscribe multiple times adds additional handlers. A component may be subscribed to a maximum of six channels at the same time. Please note that the signature of the .Net version of this function differs slightly.

FSBL.Clients.LinkerClient.subscribe("symbol", (data, response) => {
if (!response.originatedHere()) {
const data = response.data;
// Logic to perform with data
}
});

Parameters

NameTypeDescription
dataTypestringA string representing the data type to subscribe to.
listenerFunctionA function (data, response) to be called once the Linker receives the specific data. Use response.originatedHere() to determine if the calling window is also the publisher

Returns

void


unSubscribe

unSubscribe(dataType, cb): void

deprecated The LinkerClient has been deprecated.

Remove all listeners for the specified dataType.

FSBL.Clients.LinkerClient.unsubscribe("symbol");

Parameters

NameTypeDescription
dataTypestringThe data type to which the component is subscribed.
cbFunction-

Returns

void


unlinkFromChannel

unlinkFromChannel(channel, windowIdentifier?, cb?): any

deprecated The LinkerClient has been deprecated.

Unlinks a component from a Linker channel.

FSBL.Clients.LinkerClient.unlinkFromChannel("group1", null); // Unlink the current window from channel "group1"
FSBL.Clients.LinkerClient.unlinkFromChannel("group1", windowIdentifier) // Unlink the requested window from channel "group1"

Parameters

NameTypeDescription
channelstring | string[]Channel to remove, or an array of channels. If null, then all channels will be removed.
windowIdentifier?WindowIdentifierwindowIdentifier for the window. Defaults to current window if left null.
cb?FunctionOptional. Callback to retrieve returned results asynchronously.

Returns

any

Returns the new state: linked channels, all channels


unsubscribe

unsubscribe(dataType, listener?): void

deprecated The LinkerClient has been deprecated.

Remove all listeners for the specified dataType.

FSBL.Clients.LinkerClient.unsubscribe("symbol");

Parameters

NameTypeDescription
dataTypestringThe data type to which the component is subscribed.
listener?FunctionOptional. The function that was passed to subscribe. If not specified, all listeners will be deleted.

Returns

void