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. |
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. |
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. |