[TYRUS-243] WebSocketContainer.connectToServer can block for seconds Created: 26/Aug/13  Updated: 05/Sep/13  Resolved: 03/Sep/13

Status: Resolved
Project: tyrus
Component/s: client
Affects Version/s: 1.2.1
Fix Version/s: 1.3

Type: New Feature Priority: Major
Reporter: jst Assignee: Pavel Bucek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 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.



 Comments   
Comment by Pavel Bucek [ 03/Sep/13 ]

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.

Comment by jst [ 05/Sep/13 ]

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

Generated at Mon Feb 08 17:21:51 UTC 2016 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.