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

WebSocket JS error in onClose

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 8.5.1
    • 8.5.0
    • ZK Client Engine
    • Security Level: Jimmy
    • None
    • enable websockets

    • ZK 8.5.1 R1
    • None

      The attached example simulates a problem than can occur when websocket requests result in unexpected errors such as redirects (302).

      Steps to Reproduce

      run the attached file websocket-retry-error.zul
      click the button within 3 seconds and wait until 3 seconds are over

      Current Result

      2 errors messages in the browser console
      1) expected simulated redirect failure of the ws request

      zk.wpd:43016 WebSocket connection to 'ws://robert-nb:8085/zksupport85/zkau/wstest?dtid=z_jcg' failed: Error during WebSocket handshake: Unexpected response code: 302
      start @ zk.wpd:43016
      zk.afterLoad @ websocket-failure.zul:24
      doEnd @ zk.wpd:23955
      _zkf @ zk.wpd:23995
      (anonymous) @ zul.utl.wpd:529
      doEnd @ zk.wpd:23955
      _zkf @ zk.wpd:23994
      (anonymous) @ zul.utl.wpd:529
      

      2) unexpected JS error

      zk.wpd:43017 Uncaught ReferenceError: rstatus is not defined
          at WebSocket.onclose (zk.wpd:43017)
      onclose @ zk.wpd:43017
      

      further button clicks remain unresponsive

      Expected Result

      ZK should fallback to AJAX via /zkau when websocket fails

      e.g. this works in this example when clicking the button after 3 seconds
      -> onClick the event is sent to the server via AJAX successfully

            wenninghsu wenninghsu
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours
                2h