Class: ConsoleWebSocket

console-base-resource/jgconsole~ConsoleWebSocket()

Defines a wrapper class for a web socket. An instance creates and maintains a connection to a session on the server, i.e. it reconnects automatically to the session when the connection is lost. The connection is used to exchange JSON RPC notifications.

Constructor

new ConsoleWebSocket()

Source:

Methods

addMessageHandler(method, handler)

When a JSON RPC notification is received, its method property is matched against all added handlers. If a match is found, the associated handler function is invoked with the params values from the notification as parameters.

Parameters:
Name Type Description
method string

the method property to match

handler function

the handler function

Source:

close()

Closes the connection.

Source:

connect()

Establishes the connection.

Source:

consoleSessionId() → {string}

Returns the unique session id used to identify the connection.

Source:
Returns:

the id

Type
string

send(data)

Convert the passed object to its JSON representation and sends it to the server. The object should represent a JSON RPC notification.

Parameters:
Name Type Description
data Object

the data

Source: