users@websocket-spec.java.net

[jsr356-users] Re: [jsr356-experts] timeout CloseCodes(?)

From: Joakim Erdfelt <joakim_at_intalio.com>
Date: Mon, 14 Jan 2013 10:39:11 -0700

The WebSocket close codes are dictated by the RFC6455 spec.

There is no thought about how to notify on timeouts in that spec.

One thought is to just terminate the connection with no close frames, and
report to the local websocket application Endpoint.onClose() using
something like Status code 1006 with a reason phrase like "Timeout"

Per RFC6455: Section 7.4.1:
https://tools.ietf.org/html/rfc6455#section-7.4.1

      1006 is a reserved value and MUST NOT be set as a status code in a
> Close control frame by an endpoint. It is designated for use in
> applications expecting a status code to indicate that the
> connection was closed abnormally, e.g., without sending or
> receiving a Close control frame.



But since we have Endpoint.onError() we could also throw a
WebSocketTimeoutException to be a bit more specific that a local error has
occurred.

--
Joakim Erdfelt <joakim_at_intalio.com>
Jetty & CometD
eclipse.org/jetty - cometd.org
On Mon, Jan 14, 2013 at 9:36 AM, Scott Ferguson <ferg_at_caucho.com> wrote:
> I can't see how the endpoint can be notified that its connection has timed
> out (or disconnected w/o a close.)
>
> Should there be a CloseCodes.TIMEOUT (or READ/WRITE_TIMEOUT), and
> CloseCodes.CONNECTION_**DISCONNECT?
>
> Or should there be some exceptions for @WebSocketError like
> WebSocketTimeoutException (or WebSocketRead/WriteTimeout) and
> WebSocketDisconnectException.
>
> -- Scott
>
>