Skip to content

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

ArgumentTypeRequiredDescription
configObjectYes
configDecoratorFunctionNo(default: null)

disconnect

Disconnect from server

ArgumentTypeRequiredDescription
timeoutNumberYesamount 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.

ArgumentTypeRequiredDescription
publicAPIYesobject on which methods will be bounds (public)
modelYesobject on which data structure will be bounds (protected)
initialValuesobjectNo(default: {})

getConfig

getConfigDecorator

Returns

TypeDescription
FunctionconfigDecorator function if any was provided

getConnection

getCreateImageStream

Returns

TypeDescription
Booleanthe autoCreate state for imageStream

getImageStream

getNotBusyList

Returns

TypeDescription
objectthe 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

ArgumentTypeRequiredDescription
initialValuesobjectNofor pre-setting some of its content

onBusyChange

ArgumentTypeRequiredDescription
callbackYes
priorityYes

registerProtocol

Register dynamically a protocol after being connected

ArgumentTypeRequiredDescription
nameStringYes
protocolFunctionYes

setConfigDecorator

Set a config decorator to possibly alterate the config object that get received from the launcher.

ArgumentTypeRequiredDescription
decoratorYesfunction for config object

setCreateImageStream

Should the client auto listen to image stream topic by creating its imageStream object

ArgumentTypeRequiredDescription
autoCreateBooleanYes(default: true)

Returns

TypeDescription
Booleantrue if the set method modified the object

setNotBusyList

Update the list of methods that should be ignore from the busy state monitoring

Returns

TypeDescription
Booleantrue 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

TypeDescription
Booleantrue 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);
ArgumentTypeRequiredDescription
smartConnectClassYes

unregisterProtocol

Remove a given protocol from the available list

ArgumentTypeRequiredDescription
nameStringYes