Template:Ui sessions and scope description
All identified UI objects support dynamic attributes that can be changed at run-time.
The primary commands used to set dynamic attributes are the UISET action in EVENTS, and the uiSet() Java and JavaScript function.
Set levels
You can set dynamic attributes at different levels:
- global, using UISET and not specifying any session information - will set the attribute to the desired value for all clients
- client session, using UISESSIONSET on USER and PAGE events, or uiSessionSet(session, id, attr, value) in JavaScript and uiSet(String session, String id, String attr, String value) in Java - will set the attribute for a single specific client session
- application scope, using uiSessionSet(session, id, attr, value) in JavaScript and uiSet(String session, String id, String attr, String value) in Java - will set the attribute only for projects and pages that are explicitly bound (subscribed) to the same scope. You can use any string literal to identify a scope, and simply use that string in the session parameter of uiSet or uiSessionSet, instead of the client session id.
Priority rules
Overlapping global, session or scope UI attributes set on the same object is possible. In this case, a session set has the highest priority, followed by global set and finally the scope set. So, if you have a scope set on an object, and a global set is called on the same attribute of the same object, this global set will override the scope set. A session set will override both the scope and global set.
Session lifetime
While a global set will last until HSYCO is restarted, the client sessions have a limited lifetime.
Basically a client session is created whenever you load a URL pointing to an HSYCO project, and is automatically cleared after one hour of inactivity, where session activity is defined as the client being actively connected to the HSYCO server.
Scopes also have the same lifetime of client sessions, but activity in this case is defined as at least one client that is showing a page or project that is bound to the scope.
You can also create persistent scopes, simply using scope literals ending with the ! character. Persistent scopes will not follow be cleared, even after prolonged inactivity, and will last until HSYCO is restarted.