Vaadin 24 - heartbeatInterval

Halo I have project which use SpringBoot and when I try to use
vaadin.heartbeatInterval = true
how is write in documentation it not work.
Can you somebody help me?

Not sure which documentation you have read but the official documentation talks about a number (seconds) based value (which works).

Thank you for your answer. Yes my mistake, I to think it over closeIdleSessions … anyway it still doesn’t work for me
vaadin.heartbeatInterval = 300

What you mean by not working? So in other words what you are trying to do and what you expect to happen?

Just tested with:

vaadin:
  heartbeat-interval: 10

Result (working as expected; a request every 10 seconds)

For vaadin.heartbeatInterval = 300 (5min) …
I start my application which use Spring Security. I Login and I do not work my pc and I wait 20 min (3 time for heartbeat) …
After then I can work as before, but I await that my application will log out.

There are two possible causes

  1. You forgo to set closeIdleSessions = true

  2. You have Spring Security setup with SSO which autoextends your access token.

You can verify whether your setting has been applied by checking the value of VaadinService.getCurrent().getDeploymentConfiguration().getHeartbeatInterval().

If that configuration is applied as expected, then things are still a bit more complicated. The main point of the heartbeat is to detect other UI instances in the same session that should be closed when handling a request for some specific UI. The UI that the user interacts with will be marked as active through that interaction before checking for inactive UIs.

If you want a single UI to be closed, then you need to either play with the servlet container’s session expiration timeout or use an add-on that uses a background thread to eagerly close down expired UIs instead of only doing it in association with handling other requests from the same session.

I hava add closeIdleSessions = true to application.properties but I have not SSO

when I check on VaadinService.getCurrent().getDeploymentConfiguration().getHeartbeatInterval() it show me correct value what I set in application.properties.

You have on think server.servlet.session.timeout=30s

is correct when I use application.properties or existing better way?

application.properties should work if you have a Spring Boot application. Like Leif wrote above,

You can verify whether your setting has been applied by checking the value of VaadinService.getCurrent().getDeploymentConfiguration().getHeartbeatInterval() .

Next thing then would be to check in the browser’s network inspector whether there are any unexpected requests being sent that would cause the session expiration to not trigger.

There is one corner case if you use Push and update Grid data periodically using Push, the session will not expire as Grid will send request back to server after update.

We had a note about that in the previous version of the Vaadin Docs, but it seems that after recent update this note has been “lost in translation”

This is my browser’s network inspector. I set vaadin.heartbeatInterval = 20 , and waited some time but application is work.
Is it correct to think that you only need to set the heartbeat in application.properties, then log in to the application, wait for three heartbeats, and after that, any event will log out the application? Or do I need to configure additional settings?"

You need to restart the application for application.properties changes to take effect.