ZK AU Engine"

From Documentation
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{ZKConfigurationReferencePageHeader}}
 
{{ZKConfigurationReferencePageHeader}}
  
=WebSocketEndPoint=
+
=WebSocket =
[since 8.5.0]
+
{{versionSince|8.5.0}}
[Required] Class: <javadoc>org.zkoss.zkmax.au.websocket.WebSocketEndPoint</javadoc>
+
{{ZK EE}}
  
A new ZK Update Engine which is based on WebSocket, the EndPoint handles ping/pong messages from and to the client.
 
Supports only browsers that support WebSocket natively.
 
  
To enable WebSocket Connection, add the following listener into zk.xml
+
By default, ZK communicates with a server in [https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest XMLHttpRequest] or [https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch Fetch API] asynchronously. Now you can switch to WebSocket. Then <javadoc>org.zkoss.zkmax.au.websocket.WebSocketEndPoint</javadoc> handles ping/pong messages from and to the client. This feature works only for browsers that support WebSocket natively.
 +
 
 +
To enable WebSocket connection, add the following listener into zk.xml
  
 
<source lang="xml">
 
<source lang="xml">
<listener>
+
<listener>
<listener-class>org.zkoss.zkmax.au.websocket.WebSocketWebAppInit</listener-class>
+
<listener-class>org.zkoss.zkmax.au.websocket.WebSocketWebAppInit</listener-class>
</listener>
+
</listener>
 
</source>
 
</source>
  
 
To change the URL pattern, please refer to [[ZK_Configuration_Reference/zk.xml/The_Library_Properties/org.zkoss.zkmax.au.websocket.WebSocketEndPoint.urlPattern|this library property]].
 
To change the URL pattern, please refer to [[ZK_Configuration_Reference/zk.xml/The_Library_Properties/org.zkoss.zkmax.au.websocket.WebSocketEndPoint.urlPattern|this library property]].
  
When WebSocket connection is enabled, we'll use WebSocketServerPush by default when server-push started.
+
When WebSocket connection is enabled, ZK will use WebSocketServerPush by default when server-push started.
  
Note that we cannot guarantee the accessing of the information provided by http requests when WebSocket connection is enabled.
+
Note that we cannot guarantee the accessing of the information provided by HTTP requests when a WebSocket connection is enabled.
  
  
 
{{ZKConfigurationReferencePageFooter}}
 
{{ZKConfigurationReferencePageFooter}}

Latest revision as of 11:47, 13 April 2022


WebSocket

Since 8.5.0

  • Available for ZK:
  • http://www.zkoss.org/product/zkhttp://www.zkoss.org/whyzk/zkeeVersion ee.png


By default, ZK communicates with a server in XMLHttpRequest or Fetch API asynchronously. Now you can switch to WebSocket. Then WebSocketEndPoint handles ping/pong messages from and to the client. This feature works only for browsers that support WebSocket natively.

To enable WebSocket connection, add the following listener into zk.xml

<listener>
	<listener-class>org.zkoss.zkmax.au.websocket.WebSocketWebAppInit</listener-class>
</listener>

To change the URL pattern, please refer to this library property.

When WebSocket connection is enabled, ZK will use WebSocketServerPush by default when server-push started.

Note that we cannot guarantee the accessing of the information provided by HTTP requests when a WebSocket connection is enabled.



Last Update : 2022/04/13

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.