Lite Client JavaScript Library |
Lite Client |
The Lite Client JavaScript library is complete and does not require any other libraries to be loaded with it. When the library is loaded it creates a "proiv" object and an "OpenAjax" object in the browser window that holds the JavaScript code. The page should not create another "proiv" or "OpenAjax" object in the window as this will clash with the Lite Client JavaScript.
The Lite Client has a number of interface functions that can be called to manage the PROIV sessions and these are describe below. The Lite Client also uses the OpenAjax interface to share events with other JavaScript code outside the Lite Client library.
To start a PROIV session you must call the function "proiv.startPROIVSession(properties)". This takes a properties object as its single parameter. The contents of the properties object determines how the PROIV session is obtained in a secure way. The function returns a unique string that is the session key created for this session.
The Lite Client session builds all its components inside a browser document node and this node must have a unique ID in the browser. This session node ID must be in the "sessionNodeID" property in the properties object.
The PROIV session connection properties are held in the "connectionData" property in the properties object.
e.g.
var sessionKey = proiv.startPROIVSession({
sessionNodeID: "proiv_session_1",
URI: "/connect",
connectionData: {service: "LiteClentSerivce"}
});
This example connects to the PROIV session using the connection details specified in the "LiteClientService" service defined in the PROIV dashboard and uses the browser document node with an id of "proiv_session_1" to build the session components.
To end a PROIV session you must call the function "proiv.endPROIVSession(sessionKey)". This has an optional session key as its single parameter. If there is no session key or if the session key does not map to a current session, then the Active Session (see below) is ended. If there is no session key and no Active Session then the function does nothing.
e.g.
proiv.endPROIVSession(sessionKey);
This example ends the PROIV session with specified session key.
A browser page may have more than one Lite Client PROIV session running at any one time. The Lite Client has the concept of the "Active Session". This is the session that had the most recent user activity (e.g. click on a component or edit an input field) or it can be set by a function call.
e.g.
proiv.setActivePROIVSession(sessionKey);
This example sets the Active Session using the session key supplied by the startPROIVSession function. Note that the Active Session may change next time the user interacts with a PROIV component.
The Active Session is used if an end session function call is made with an unrecognised or absent session key. It is also used to target user events that are not explicitly caused on a component. For example, an accelerator key is detected by the browser and sent to the correct component but there may be two sessions each with a component using the same accelerator key. In this case the key is sent to the component in the Active Session.
Topic ID: 870024