Class: ClientWebsocket

ClientWebsocket

ClientWebsocket

new ClientWebsocket( [options])

Constructor for a Jayson Websocket Client
Parameters:
Name Type Argument Description
options Object <optional>
Properties
Name Type Argument Description
url String <optional>
When options.ws not provided this will be the URL to open the websocket to
ws ws.WebSocket <optional>
When not provided will create a WebSocket instance with options.url
timeout Number <optional>
Will wait this long in ms until callbacking with an error
Source:
Returns:
Type
ClientWebsocket

Extends

Methods


request(method, params [, id] [, callback])

Creates a request and dispatches it if given a callback.
Parameters:
Name Type Argument Description
method String | Array A batch request if passed an Array, or a method name if passed a String
params Array | Object Parameters for the method
id String | Number <optional>
Optional id. If undefined an id will be generated. If null it creates a notification request
callback function <optional>
Request callback. If specified, executes the request rather than only returning it.
Inherited From:
Source:
Throws:
Invalid parameters
Type
TypeError
Returns:
JSON-RPC 1.0 or 2.0 compatible request
Type
Object

unlisten()

Removes all event listeners from Websocket instance which cancels all outstanding requests too
Source: