Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-1979

Server push doesn't work when open 2 browser tab

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 6.5.5
    • 6.5.3
    • ZK Update Engine
    • Security Level: Jimmy
    • None
    • None

      <zk>
      	<window title="test of long operation" border="normal">
      	    <zscript><![CDATA[
      			EventQueue eq = EventQueues.lookup("longop"); //create a queue
      			String result;
      			
      			//subscribe async listener to handle long operation
      			eq.subscribe(new EventListener() {
      			  public void onEvent(Event evt) { //asynchronous
      			    org.zkoss.lang.Threads.sleep(2000); //simulate a long operation
      			    result = "success"; //store the result
      			  }
      			}, new EventListener() { //callback
      			  public void onEvent(Event evt) {
      			    print(result); //show the result to the browser
      			    EventQueues.remove("longop");
      			  }
      			});
      			 
      			 void print(String msg) {
      			     new Label(msg).setParent(inf);
      			 }
      	    ]]></zscript>
      	    <button label="async long op">
      	        <attribute name="onClick"><![CDATA[
      			   print("Wait for 2 seconds");
      			   eq.publish(new Event("whatever")); //kick off the long operation
      	        ]]></attribute>
      	    </button>
      	    <vbox id="inf"/>
      	</window>
      	
      </zk>
      

            jumperchen jumperchen
            jimmyshiau jimmyshiau
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: