WSLinkClient
Introduction
vtkWSLinkClient is a WSLink client for talking to a server over WebSocket
Methods
beginBusy
Virtually increase work load to maybe keep isBusy() on while executing a synchronous task.
connect
Initiate the connection with the server
| Argument | Type | Required | Description |
|---|---|---|---|
config | Object | Yes | |
configDecorator | Function | No | (default: null) |
disconnect
Disconnect from server
| Argument | Type | Required | Description |
|---|---|---|---|
timeout | Number | Yes | amount of second to wait before the server exit as well. If we want to avoid the server from quitting, -1 should be provided. (default=60) |
endBusy
Virtually decreasing work load to maybe free isBusy() after executing a synchronous task. Other async calls could still keep the state as busy.
extend
Method use to decorate a given object (publicAPI+model) with vtkWSLinkClient characteristics.
| Argument | Type | Required | Description |
|---|---|---|---|
publicAPI | Yes | object on which methods will be bounds (public) | |
model | Yes | object on which data structure will be bounds (protected) | |
initialValues | object | No | (default: {}) |
getConfig
getConfigDecorator
Returns
| Type | Description |
|---|---|
| Function | configDecorator function if any was provided |
getConnection
getCreateImageStream
Returns
| Type | Description |
|---|---|
| Boolean | the autoCreate state for imageStream |
getImageStream
getNotBusyList
Returns
| Type | Description |
|---|---|
| object | the current set of methods to ignore from busy state |
getProtocols
Get protocols that were either provided in newInstance or via its set
getRemote
invokeBusyChange
isBusy
Return the current state of busy. Do we still have pending calls?
isConnected
Return true if the client is currently connected to a server
newInstance
Method use to create a new instance of vtkWSLinkClient
| Argument | Type | Required | Description |
|---|---|---|---|
initialValues | object | No | for pre-setting some of its content |
onBusyChange
| Argument | Type | Required | Description |
|---|---|---|---|
callback | Yes | ||
priority | Yes |
registerProtocol
Register dynamically a protocol after being connected
| Argument | Type | Required | Description |
|---|---|---|---|
name | String | Yes | |
protocol | Function | Yes |
setConfigDecorator
Set a config decorator to possibly alterate the config object that get received from the launcher.
| Argument | Type | Required | Description |
|---|---|---|---|
decorator | Yes | function for config object |
setCreateImageStream
Should the client auto listen to image stream topic by creating its imageStream object
| Argument | Type | Required | Description |
|---|---|---|---|
autoCreate | Boolean | Yes | (default: true) |
Returns
| Type | Description |
|---|---|
| Boolean | true if the set method modified the object |
setNotBusyList
Update the list of methods that should be ignore from the busy state monitoring
Returns
| Type | Description |
|---|---|
| Boolean | true if the set method modified the object |
setProtocols
Assign protocols to the client. Those will only be used at connect time and therefore needs to be set before being connected otherwise registerProtocol should be used instead.
Returns
| Type | Description |
|---|---|
| Boolean | true if the set method modified the object |
setSmartConnectClass
Bind optional dependency from WSLink to our current class. This is mandatory when using that class
import SmartConnect from 'wslink/src/SmartConnect';
import vtkWSLinkClient from '@kitware/vtk.js/IO/Core/WSLinkClient';
vtkWSLinkClient.setSmartConnectClass(SmartConnect);| Argument | Type | Required | Description |
|---|---|---|---|
smartConnectClass | Yes |
unregisterProtocol
Remove a given protocol from the available list
| Argument | Type | Required | Description |
|---|---|---|---|
name | String | Yes |