Class WebSocketServerPush

  • All Implemented Interfaces:
    org.zkoss.zk.ui.sys.ServerPush

    public class WebSocketServerPush
    extends java.lang.Object
    implements org.zkoss.zk.ui.sys.ServerPush
    A server-push implementation that is based on WebSocket. This is the default server-push class when WebSocket connection is enabled. To enable WebSocket connection, please refer to WebSocketWebAppInit for more information.
    Since:
    8.5.0
    Author:
    wenninghsu
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean activate​(long timeout)  
      boolean deactivate​(boolean stop)  
      boolean isActive()  
      void onPiggyback()  
      void resume()  
      <T extends org.zkoss.zk.ui.event.Event>
      void
      schedule​(org.zkoss.zk.ui.event.EventListener<T> listener, T event, org.zkoss.zk.ui.sys.Scheduler<T> scheduler)  
      void setReady​(boolean ready)  
      protected void setWebSocketConnectionInfos​(WebSocketEndPoint webSocketEndpoint, javax.servlet.http.HttpServletRequest request)  
      void start​(org.zkoss.zk.ui.Desktop desktop)  
      protected void startClientPush()
      Sends an AU response to the client to start the server push.
      void stop()  
      protected void wakePending()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • WebSocketServerPush

        public WebSocketServerPush()
    • Method Detail

      • setReady

        public void setReady​(boolean ready)
      • setWebSocketConnectionInfos

        protected void setWebSocketConnectionInfos​(WebSocketEndPoint webSocketEndpoint,
                                                   javax.servlet.http.HttpServletRequest request)
      • isActive

        public boolean isActive()
        Specified by:
        isActive in interface org.zkoss.zk.ui.sys.ServerPush
      • start

        public void start​(org.zkoss.zk.ui.Desktop desktop)
        Specified by:
        start in interface org.zkoss.zk.ui.sys.ServerPush
      • stop

        public void stop()
        Specified by:
        stop in interface org.zkoss.zk.ui.sys.ServerPush
      • resume

        public void resume()
        Specified by:
        resume in interface org.zkoss.zk.ui.sys.ServerPush
      • startClientPush

        protected void startClientPush()
        Sends an AU response to the client to start the server push. It is called by start(org.zkoss.zk.ui.Desktop).

        The derived class usually overrides this method to support different devices.

        The default implementation is to send an AuScript response.

      • schedule

        public <T extends org.zkoss.zk.ui.event.Event> void schedule​(org.zkoss.zk.ui.event.EventListener<T> listener,
                                                                     T event,
                                                                     org.zkoss.zk.ui.sys.Scheduler<T> scheduler)
        Specified by:
        schedule in interface org.zkoss.zk.ui.sys.ServerPush
      • activate

        public boolean activate​(long timeout)
                         throws java.lang.InterruptedException,
                                org.zkoss.zk.ui.DesktopUnavailableException
        Specified by:
        activate in interface org.zkoss.zk.ui.sys.ServerPush
        Throws:
        java.lang.InterruptedException
        org.zkoss.zk.ui.DesktopUnavailableException
      • deactivate

        public boolean deactivate​(boolean stop)
        Specified by:
        deactivate in interface org.zkoss.zk.ui.sys.ServerPush
      • wakePending

        protected void wakePending()
      • onPiggyback

        public void onPiggyback()
        Specified by:
        onPiggyback in interface org.zkoss.zk.ui.sys.ServerPush