Only 1 static session for all users.

I don’t want to creat new UI per Session. How can I do?
I need only 1 UI for all sessions.

Now i have exceptions when trying to open new window
java.lang.IllegalStateException: Can't move a node from one state tree to another. If this is intentional, first remove the node from its current state tree by calling removeFromTree at com.vaadin.flow.internal.StateNode.doSetTree(StateNode.java:738) ~[flow-server-23.1.6.jar:23.1.6]

I need 1 session from different devices.

Not possible - what is your use case?

unknown.png

I have exception when trying to open it by another device

Sounds like you are reusing components (wrong scope) which is not possible

I think the best you could maybe do is prevent opening new browser tabs if you have one open in the same Session

And “prevent” it in the sense of giving an error message after the first one

Even then, you might need to add some extra logic to make sure the session is cleaned up if the original browser tab is closed, and that’s not trivially implemented

And sharing a single session between different devices is just fundamentally against the whole concept of a browser session

then I think I should just close the old session and transfer control rights to the new session, but not create a new state inside the program. How is it possible to implement it?

VaadinService allows adding session init listeners, at least

But really, that does sound like a very non-standard approach.

Is someone can show code example?
How do changes in state from different sessions?

Maybe. I’m not asking very correctly. I need one page which will change from different sessions. it will only have one copy. Like a SingleTON

i can’t find a solution

dosn’t work
unknown.png

If I get your use case right, you could store your state globally, for example in a bean or in a singleton, and access the same state object in your UIs. The other UIs will not update automatically. You need to solve that on your own. You could use an observer pattern. At least that’s what I have done when creating a small collaboration tool. But maybe I misunderstood your use case.

ui always is Empty. why…
unknown.png

I want to close the old one when opening a new session, this will be enough for me. But I don’t know how to implement it. I do not understand how this framework works and where what is created. Can anyone show an example of how this can be implemented?

You are better off using https://vaadin.com/docs/latest/advanced/service-init-listener instead of doing it on the view level