ws¶
Object: jstp.ws¶
jstp.ws.connect(app, client, webSocketConfig, requestUrl, callback)¶
app
<string>
|<Object>
Application to connect to as'name'
or'name@version'
or{ name, version }
, where version must be a valid semver range.client
<Client>
|<null>
Optional, when omitted, an object with the default values forapplication
,connectPolicy
andreconnector
is used.webSocketConfig
<WebSocketClientConfig>
requestUrl
<string>
|<URL>
callback
<Function>
error
:<Error>
connection
:<Connection>
jstp.ws.connectAndInspect(app, client, interfaces, webSocketConfig, requestUrl, callback)¶
app
<string>
|<Object>
Application to connect to as'name'
or'name@version'
or{ name, version }
, where version must be a valid semver range.client
<Client>
|<null>
Optional, when omitted, an object with the default values forapplication
,connectPolicy
andreconnector
is used.interfaces
<string[]>
Interface names to perform inspect on.webSocketConfig
<WebSocketClientConfig>
requestUrl
<string>
|<URL>
callback
<Function>
error
:<Error>
connection
:<Connection>
proxies
<Object>
[interfaceName]
<RemoteProxy>
For more details see jstp.net.connectAndInspect()
.
jstp.ws.reconnect(connection, webSocketConfig, requestUrl, callback)¶
connection
:<Connection>
webSocketConfig
<WebSocketClientConfig>
requestUrl
<string>
|<URL>
callback
<Function>
error
:<Error>
connection
:<Connection>
For more details see jstp.net.reconnect()
.
jstp.ws.createServer(options[, listener])¶
options
<Object>
|<Application[]>
applications
<Application[]>
|Map
Applications array or index obtained fromjstp.createAppsIndex()
.authPolicy
<AuthPolicy>
|<Function>
If the function is provided, it is expected to have the same signature asAuthPolicy.authenticate()
.sessionStorageProvider
<SessionStorageProvider>
If provided, this is used to store sessions for applications that do not have its own storage provider. Defaults to usingSimpleSessionStorageProvider
with its default settings.heartbeatInterval
<number>
Omitting this option disables heartbeat.clientExpirationTime
<number>
Time it takes for client's connection and corresponding session cache, stored in memory after the connection is closed, to expire. Defaults to3600000
(1 hour).
listener
<Function>
Automatically set as a listener for the'connect'
event.
For additional options see documentation for
WebSocketServer
. Some of the options are not configurable,
though, in particular httpServer
, autoAcceptConnections
,
maxReceivedFrameSize
, and maxReceivedMessageSize
. However, beware, some of
the other options may interfere with the correct functioning of the JSTP
protocol.
For more details see jstp.net.createServer()