Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Check if UI is alive from server
Hi,
Is it possible to check, given a UI id, if that UI is still alive? From the Servlet or the ContextListener maybe?
I would like to not wait for the server to discover it when we miss three heartbeats, but proactively asking if a certain UI is still alive.
Thanks
Normally, the server-side just processes client requests as they come. So, you have such active client polling, you'd need a separate thread to do that and use server push to make polling. For polling the client, you could execute a JavaScript call to a server-side callback.
However, as we are talking about push, AFAIK the push transport already does connection management and knows if the client is alive, so you don't need polling. I don't know if the push APIs are very exposed, but maybe can be accessed.
Thank you for the info.
The other option is to set a low heartbeat. What is the lowest you recommend to use? I guess it is directly connected with how many client at the same time I expect to have?