How to get active user/sessions in Vaadin 23?

Is there a possibility to get all logged in Users in vaadin.
Also if the user is inactive for a while it should not count as active user.

My idea is to utilize the VaadinServiceInitListener for this and add an session init and session destroy listener within the serviceInit method.
What do you think?

Thanks and best Regards

To me that sounds like to way to do it.

You can probably find that kind of setup in some (of the many) chat examples out there in the internets.

Yes, you can use that approach and then have application scoped bean where you have the bookkeeping if you use dependency injection framework. Note though, this works only in case of your application running on a single node. If you have many, then you need external event bus service where to do the book keeping. Nowadays need for this is getting smaller and smaller, as SSO systems do have management UI’s, so that those are not needed as per application.

Thanks, there is only one server running and that will not change.