The JSR-356 WebSocketContainer has no concept of a connect timeout. Sorry.
(its missing from the API and Spec)

There is nothing currently in the Jetty impl of
javax.websocket.WebSocketContainer to provide this in a JSR standard way.

However, if you don't mind jetty specifics ...

        import org.eclipse.jetty.websocket.jsr356.ClientContainer;

        WebSocketContainer container =
ContainerProvider.getWebSocketContainer();

        // Jetty specific
        if(container instanceof ClientContainer)
        {
            ClientContainer jettyContainer = (ClientContainer) container;
            jettyContainer.getClient().setConnectTimeout(2000);
        }


--
Joakim Erdfelt <[email protected]>
webtide.com <http://www.webtide.com/> - intalio.com/jetty
Expert advice, services and support from from the Jetty & CometD experts
eclipse.org/jetty - cometd.org


On Thu, Dec 5, 2013 at 7:33 AM, Kasper Nielsen <[email protected]> wrote:

> Hi,
>
> I've switched from Jetty's websocket interfaces to using
> javax.websocket.WebSocketContainer and friends.
> When I used Jetty's interfaces I could specify a connect timeout however
> WebSocketContainer
> blocks until a connection has been made.
>
> Anyway to control the timeout? I could spin of a thread that would
> interrupt the current thread. If no progress has been made in 10 seconds.
> But I would rather use something less hackish.
>
> - Kasper
>
> _______________________________________________
> jetty-users mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>
>
_______________________________________________
jetty-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to