How to detect browser closed?

Hi ~
I try to retriect on the user Single Sign On, but I found difficult on dectect on Browser closed Event.
However, I notice when I open an page and re-bounce the server, the page will immediatelly display Red-Waring Message “Sesssion Expired…”.
So, I think by default the Vaadin component should have some Heartbeat message. Which might be able to use for browser closed dection.

So, is any one know how to use on this Heartbeat event (or Commnunication)?
Any sample code will be appreciated!
Thanks

Have a look at this chapter:
https://vaadin.com/book/vaadin7/-/page/application.lifecycle.html

It should give you a basic idea how to use and implement heartbeat.

Also there are some posts on forum discussing this topic.