detach() method fire only on undeploy

I have set heartbeat interval to 1 and then closed tab with application, but detach() not has been fire.
I need to detect when client is disconnected. But i tried to to add Detach listener, override close() detach(), but nothing happens.
All listeners fires when i redeploy application.
Any suggestions ?

The heartbeat mechanism doesn’t currently have a background cleanup thread or anything like that - old UIs are cleaned up every time there’s a request to a still-open UI. So it prevents a huge number of stale UIs from accumulating, but any given UI may need to wait until the session expires if the user doesn’t interact with other UIs in the same session. We do have plans to add some sort of a periodic cleanup mechanism in the future.