best way to check user is idle and trigger logout event in vaadin 23

I want to check if user is idle and then auto logout (end user session and logout).
Vaadin heartbeat will work for this ?

Yes, you can use the heartbeat listener (accessible from the UI) for it and calculate the idle time

how from heartbeat, i know user is idle ?

The heartbeat is a periodic event which is send to the server without increasing the Session:: lastRequestTime - now the remaining work is up to you :wink:

you mean: UI.getCurrent().getSession().getLastRequestTimestamp(); will return most recent time of an event that user did on client side, eg. mouse click,… ?
let say in 10 minutes, user doesn’t do any action on client side (user idle), then i will get 10 minutes from getLastRequestTimestamp after 2 heartbeats sending to server


Not client side, but event that hit the server

Thanks @quirky-zebra :grinning: