tyrus
  1. tyrus
  2. TYRUS-243

WebSocketContainer.connectToServer can block for seconds

    Details

    • 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:
      None

      Description

      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.

        Activity

        Hide
        Pavel Bucek added a comment -

        fix merged to the master branch (see rev. 90edb2a6378ef92c4ffc3af231a5962ef3712cb3)

        ClientManager now has async* alternatives to connectToServer methods. More details will follow in the user doc and/or blog post.

        Show
        Pavel Bucek added a comment - fix merged to the master branch (see rev. 90edb2a6378ef92c4ffc3af231a5962ef3712cb3) ClientManager now has async* alternatives to connectToServer methods. More details will follow in the user doc and/or blog post.
        Hide
        jst added a comment -

        OK, let me know when you document/blog about it.

        Show
        jst added a comment - OK, let me know when you document/blog about it.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: