Namespace: LiveView

LiveView

Classes

Table
Query
QueryProperties
Schema
Field
Tuple
Error
Connection
QuerySubscription
AlertRule

Methods

staticLiveView.connect(settings){Promise.<LiveView.Connection>}

Connects to the LiveView server. If no settings are provided, the function will attempt to connect to the the host identified by the current window location via the path '/lv/client'. The protocols used by the LiveView connection will correspond to the protocol used by window.location. If window.location specifies HTTPS as its protocol, then commands issued to LiveView will also be sent via HTTPS and all traffic sent or received via WebSocket will also be done via a secure connection.
Name Type Description
settings Object optional Object containing the settings for performing the connection
Name Type Description
url String optional The URL of the LiveView server to connect to. The format of the url should be of the form: http://hostname:port/path/to/lv/client or /path/to/lv/client. For example: http://localhost:10080/lv/client or /lv/client. If a pathname is given as the URL, the API will attempt to connect to the host identified by the current window location. If no url is specified, the API will attempt to use '/lv/client'.
username String optional The username to use when authenticating with the LiveView server.
password String optional The password to use when authenticating with the LiveView server.
clientInfo String optional Additional information sent with the connection request that appears in LDM system tables as ClientInfo.
transportUrl String optional If your environment requires web socket data be sent and received via a host that is not the same as the one defined by the settings.url property, set the settings.transportUrl to be the web socket URL that the LiveView JS API should use when making the web socket connection (e.g. 'ws://my.wsproxy.net:9000'). Both normal and secure web socket URLs (i.e. those beginning with 'ws://' and 'wss://' respectively) are supported. This is considered an advanced setting and should not be changed in most scenarios. If you are deploying your application via cloud services, this setting may be required as some cloud service providers require web socket traffic be proxied via a specific port.
onClose function optional Callback function to invoke upon closure of the connection (whether in error or as expected). The callback will be passed an object containing two or three fields: connection, actor, and (optionally) error. The connection field will be the Connection that was closed. The actor field will be "client", "browser", "server", or "unknown" depending on whether the client, browser (typically the result of the user clicking refresh), server, or an error caused the closing of the connection. The error field (if set) is an Error. The presence of the error field indicates an error took place and the connection was closed as a result.
context Object optional Object to use as the context for all callback functions. Use this if you need the callbacks to execute within a specific context or scope other than the global window.
onStreamError function optional Callback function to invoke if an error occurs in the underlying streaming connection to LiveView. The callback will be passed an Error object containing details about what went wrong. You can change this function later by setting the transport.onStreamError property of your connection instance.
onSuccess function optional Callback function to invoke upon successful connection to LiveView. The callback function will be passed an object containing one field: connection:Connection The new connection that was created.
onError function optional Callback function to invoke upon failure to connect to LiveView. The callback function will be passed an Error object containing details about what went wrong.
Type Description
Promise.<LiveView.Connection> -- Promise representing the result of the connect function. Upon successful connection, the promise will be resolved and the resolution handler function will be passed a Connection object that represents the opened connection. If the connection fails, the promise will be rejected and the rejection handler will be passed an Error object with details about what went wrong.

staticLiveView.closeAllConnections(settings){Promise.<void>}

Closes all currently active LiveView connections
Name Type Description
settings Object Object containing the settings for performing the connection
Name Type Description
context Object optional Object to use as the context for all callback functions. Use this if you need the callbacks to execute within a specific context or scope other than the global window.
onSuccess function optional Callback function to invoke upon successful closure of all connections. The callback function will not be passed any parameters.
onError function optional Callback function to invoke upon failure to close all connections. The callback function will be passed an Error object containing details about what went wrong.
Type Description
Promise.<void> -- Promise representing the result of the closeAllConnections function. Upon successfully closing all connections, the promise will be resolved and the resolution handler will be invoked with no arguments. If closing connections fails, the promise will be rejected and the rejection handler will be passed an Error object with details about what went wrong.