Hi Gopal,
I've been looking into this lately too. From what I've turned up, it looks the like the `onclose` event on the websocket isn't firing. Apparently, this can take quite some time to happen, as Chrome won't close the websocket until the TCP connection times out and stops retrying. See
http://code.google.com/p/chromium-os/issues/detail?id=14734 and
http://code.google.com/p/chromium/issues/detail?id=76358 for related info. There's some disagreement in those threads about when it's appropriate to trigger `onclose`.
On my system, I changed `net.ipv4.tcp_retries2` from 15 to 1, and then turned off my network. It took about 5 minutes for `onclose` to fire, which caused `client._transport._state` to change to 1 and Faye to trigger `transport:down`. With the default setting, I believe it took over 30 minutes of network downtime for this to occur. It's time consuming to reproduce so I haven't bothered to.
You may be able to use `navigator.onLine` in conjunction with the `transport:down` event on the client to keep better track of how online you are. This will toggle as soon as your network manager state changes (eg wifi drops, network shutdown for computer to sleep etc).
That said, there may well be other issues with the `onclose` event not firing. This is just my first foray into figuring it out! In any case, I don't expect there's anything Faye can do about `onclose` not happening, and it appears to behave correctly when it does happen.
All the best,
Nicholas