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. |
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 either be "client" or "server" depending on whether the client or server initiated 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. |