Configuration"
m |
|||
Line 10: | Line 10: | ||
==Page-level Configuration== | ==Page-level Configuration== | ||
− | You could configure a particular ZK page to use a particular implementation by use of <javadoc method="enableServerPush(org.zkoss.zk.ui.sys.ServerPush)" type="interface">org.zkoss.zk.ui.sys.DesktopCtrl</javadoc>. | + | You could configure a particular ZK page to use a particular implementation by use of <javadoc method="enableServerPush(org.zkoss.zk.ui.sys.ServerPush)" type="interface">org.zkoss.zk.ui.sys.DesktopCtrl</javadoc>. For example, |
+ | |||
+ | <source lang="java"> | ||
+ | ((DesktopCtrl)desktop).enableServerPush( | ||
+ | new org.zkoss.zk.ui.impl.PollingServerPush(2000,5000,-1)); | ||
+ | </source> | ||
==Application-level Configuration== | ==Application-level Configuration== |
Revision as of 06:33, 23 November 2010
ZK have two implementations: PollingServerPush and CometServerPush. As their name suggest, they implement the Client-Polling and Comet (aka., long-polling) server pushes.
The default implementation depends on which ZK edition you use. If ZK CE and PE, PollingServerPush will be used. If ZK EE, CometServerPush will be used. You configure ZK to use the one you prefer, even to use a custom server push.
Choose an Implementation
Client-polling is based on a timer that peeks the server continuously to see if any data to be pushed to the client, while Comet establishes a permanent connection for instant push. Client-polling will introduce more traffic due to the continuous peeks, but Comet will consume the network connections that a server allows.
Page-level Configuration
You could configure a particular ZK page to use a particular implementation by use of DesktopCtrl.enableServerPush(ServerPush). For example,
((DesktopCtrl)desktop).enableServerPush(
new org.zkoss.zk.ui.impl.PollingServerPush(2000,5000,-1));
Application-level Configuration
Customize Client-Polling
Version History
Version | Date | Content |
---|---|---|