LiveView

LiveView

Classes

AlertRule
Connection
Error
Field
Permission
Query
QueryProperties
QuerySubscription
Schema
Table
Tuple

Methods

(static) closeAllConnections(settings) → {Promise.<void>}

Closes all currently active LiveView connections
Parameters:
Name Type Description
settings Object Object containing the settings for performing the connection
Properties
Name Type Attributes 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.
Returns:
-- 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.
Type
Promise.<void>

(static) connect(settingsopt) → {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.
Parameters:
Name Type Attributes Description
settings Object <optional>
Object containing the settings for performing the connection
Properties
Name Type Attributes 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.
transport String <optional>
The transport to use for streaming data from the LiveView server. Possible values are websocket or long-polling. Default value is websocket. This is considered an advanced setting and should not be changed in most scenarios.
fallbackTransport String <optional>
The fallback transport to use for streaming data from the LiveView server. Possible values are websocket or long-polling. Default value is long-polling. This is considered an advanced setting and should not be changed in most scenarios.
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.
Returns:
-- 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.
Type
Promise.<LiveView.Connection>