Class: LinkerClient

Linker Client

Public API for The Linker Service

The Linker Client acts as an API between components and the Linker Service. The Linker Client allows for sharing of data between components such as when a symbol or an account changes in one window, it can be changed in all Linked windows automatically. See our tutorial on Linking Components.

When a Component is "linked", it is added to a Linker group. Linker groups are not related to Docking groups. All clients belonging to a Linker group can subscribe and receive published items for any dataType on the same group.

Methods

addToGroup
(groupName, client, cb)

clients/linkerClient.js, line 126

Add a client to a Linker group programatically. Clients will receive all items published to this group. The Window manager uses this internally to add a component to a group when the user clicks on a color in the Linker Window.

Name Type Description
groupName string

Group to add to

client string

The window name of the client

cb LinkerClient~groupsCB optional

Returns all the groups for the client

Example
LinkerClient.addToGroup("group1", "windowNameHere", callback)

publish
(params, cb)

clients/linkerClient.js, line 434

Publish data to all listeners for a group and data type.

Name Type Description
params Object

the name of the group subscribing to

Name Type Description
dataType String

The data type sending

data any

the data being transmitted

cb function optional

callback to be called on success

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

removeFromGroup
(groupName, client, cb)

clients/linkerClient.js, line 160

Removes a client from a Linker group programatically. The Window manager uses this internally to remove a component from a group when the user clicks on a color in the Linker Window corresponding to a Linker group that the window belongs to.

Name Type Description
groupName string

Group to remove

client string

The window name of the client

cb LinkerClient~groupsCB optional

Returns all the groups for the client

Example
LinkerClient.removeFromGroup("group1", "windowNameHere", callback)

subscribe
(dataType, func)

clients/linkerClient.js, line 472

Registers a client for a specific data type that is sent to a group.

Name Type Description
dataType String
func function optional

a function to be called once the linker receives the specific data.

Example
LinkerClient.subscribe("symbol",func)

unSubscribe
(groupName, dataType, cb)

clients/linkerClient.js, line 420

Remove a listener to the specified group and data type

Name Type Description
groupName String

the name of the group subscribing to

dataType String

The data type be subscribed to

cb function optional

callback to be called on success

Example
LinkerClient.subscribe("group1","symbol",cb)

Type Definitions

groupObject

Linker group

Properties:
Name Type Description
name string
color string
border string

groupCB
(err, responseMessage)

clients/linkerClient.js, line 585

Callback that returns a list of groups in the responseMessage

Name Type Description
err Object
responseMessage LinkerClient~groups