1. tyrus
  2. TYRUS-243

WebSocketContainer.connectToServer can block for seconds


    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.1
    • Fix Version/s: 1.3
    • Component/s: client
    • Labels:


      I am using Tyrus Client to connect to a chess server via WebSocket protocol. There is a input field that allows the user to specify the URL and button "Connect" that tries to open the connection. Alas, if the URL is mistyped, it takes seconds for the method connectToServer to return. For the whole time the UI is blocked.

      I have workarounded that by doing to WebSocketContainer.connectToServer call in different thread. But that is not very comfortable (given the fact that the rest of the API - e.g. @OnOpen, @OnError, @OnMessage, @OnClose is well designed to not require me to care about launching threads) and certainly it is much less usable than the JavaScript WebSockets specification: http://www.w3.org/TR/2011/WD-websockets-20110419/

      In JavaScript one can do new WebSocket("ws://...") - the system just checks the URL is syntactically OK and returns immediately. Failure to connect would be notified to @OnError method.

      A really non-blocking "connect" method would be nice.


        jst created issue -
        Pavel Bucek made changes -
        Field Original Value New Value
        Issue Type Bug [ 1 ] New Feature [ 2 ]
        Priority Minor [ 4 ] Major [ 3 ]
        Pavel Bucek made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.3 [ 16600 ]
        Resolution Fixed [ 1 ]


          • Assignee:
            Pavel Bucek
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: