tavendo/AutobahnAndroid — pull request #18 by zerodivisi0n (2012-09-18 07:34:28+00:00)
Title: Check connection activity

Added sending pings if no activity on connection. If no response is received, connection is likely lost.

I found that the writing to `SocketChannel` succeeds even if the connection is broken. Even there is a [bug](http://code.google.com/p/android/issues/detail?id=18989) in Android. It exists everywhere, including 4.1.

So the only way to determine the loss of connection is sending WebSocket pings. My solution is based on similar in [Pusher Protocol](http://pusher.com/docs/pusher_protocol#ping-pong).