Hi Matthew,
the problem is that underlying VM does not see the connection as closed
- so sendTimeout won't be applied, because the message is sent; same for
idleTimeout on Session object - but that is because you are sending ping
frames.
Unfortunately, I don't have any good solution for you - we might need to
investigate why the connection is not closed and maybe tweak Socket
timeouts or other low level properties in Grizzly.
If you can - it might help to recreate this via standard java socket
object - you don't need to send websocket messages, anything else will
do - and if you will be able to set them to timeout properly, you might
even consider modifying appropriate code in tyrus client and send a pull
request.
Thanks!
Pavel
On 04/11/14 00:24, Matthew Mah wrote:
> I am trying to detect websocket disconnects for an Android client. I
> expect to be able to do this by using a RemoteEndpoint.Async, setting
> its timeout to a relatively small value (10000 ms = 10 sec) , and
> sending ping messages regularly.
>
> endpoint = session.getAsyncRemote();
> endpoint.setSendTimeout(10000);
>
> However, when I disconnect the server endpoint from the network, the
> Android client continues to send ping messages indefinitely without
> any notice. I am expecting to either see session.isOpen() return
> false, or a endpoint.sendPing(empty) throw an exception.
>
> I have verified the Android device is sending pings at the server
> through wireshark.
>
> Is there something I am missing? How should the timeout show up?
>
>