An Extension library for jQuery clients of Java Web applications is provided with the jQuery plugin jquery.icepush.js.
This function will add the client page to a push group, and register the provided callback listener with the ICEpush bridge. The callback listener will be called when a push notification occurs for the specified group.
Here the client registers itself with an ICEpush group called 'time', and provides an anonymous callback listener function. The group 'time' does not have to be previously declared on the server or client, and will be created by the ICEpush bridge when this registration occurs. When any notifications for the group 'time' occur, the ICEpush bridge will call this function, and the function will make a call to the server with the jQuery $.fn.load(url); function and update an element with the id of 'timeElem' on the page. These push events can be triggered on the client through a call to ice.push.notify(groupName); or from the server-side with the Java API.
This function will remove the client page from a joined group, unregistering the client from a previously registered group.
Here clicking the button will remove the client page from the 'time' group, removing all callbacks registered for that group.
If we had multiple different callback functions registered to the time group we could selectively remove individual functions this way:
The function will register the client page with an ICEPush group, and automatically call the provided url when an ICEpush event occurs for the registered group. When a push event occurs, a HTTP GET request will be made for the provided url, and the HTML response will be loaded into all selected elements from the jQuery object.
This code starts with the jQuery selector $('div.time') which selects the two divs above the script. The .loadPushUpdates('time','./time'); registers the client page with the ICEpush group 'time'. When an ICEpush notification occurs for the group 'time', the url './time' will be called with an HTTP GET request, and the resulting response will be placed inside both selected div elements.
The function will register the client page with an ICEPush group, and automatically call the provided url when an ICEpush event occurs for the registered group. When a push event occurs, a HTTP GET request will be made for the provided url, and the HTML response will be appended into all selected elements from the jQuery object.
This code will work exactly as $('div.time').loadPushUpdates("time","./time"); in the example above, although the content will be appended into the selected elements. So in this case the title in each div would remain after any update, and any content appended into the elements from previous push updates would also remain.
© Copyright 2017 ICEsoft Technologies Canada Corp.