Is there a way to restrict concurrent logins for a user?

Is there a way to restrict the number of times a user can be logged in concurrently? We charge per-user, and if our clients can simply login 10, 20, 30, etc times on a single login, we have no way to enforce this.

  1. There is a topic on sending messages/notifications to logged in users here Communication between core application and backoffice ui

It accesses Vaadin sessions to detect logged in users, So I suppose that could be an entrypoint.

It is not clear to me how Vaadin session state is maintained (only heartbeat)?

  1. In the past, on another (non-cuba/non-jmix/non-vaadin) project I needed similar behavior for a dynamic scaling user cache. I solved it there by setting up websocket connections, because websocket connections events include disconnect (eg. by closing browser window). This is guaranteed behavior, it is part of the websocket specification.

This was the only guaranteed way of being notified of a browser being closed, there was no javascript solution other than heartbeats.

If Vaadin supports maintaining heartbeat through websocket solution 1 might be enough. (Or, if you can live with a delay equal to that heartbeat)

Eh. Delving down into Vaadin seems to maybe NOT be the most “Jmix-y” way to handle this.

I’m hoping for some “cleaner” examples.

aaah, good point.

I assumed you already exhausted those possibilities and were looking for a different solution.

Nah, I’m actually hoping for an “idiomatic Jmix” example before I even put a bunch of time into it.