
Security context aware and buffered event dispatching for asynchronous UI updates with Vaadin
Often there is the requirement to push data updates from the server to the client-side. Imagine a chat app showing incoming messages in the client’s browser. New messages should get displayed automatically without polling, the user shouldn’t need to trigger some action to fetch new messages. In general UI push updates (https://vaadin.com/docs/v15/flow/advanced/tutorial-push-access.html) are pretty easy to implement with Vaadin by default, but there are some special cases we have to deal with.
In this article I want to show you a way to achieve asynchronous UI updates with Vaadin without data flooding or overloading the server to client connection when many concurrent push requests arrive. In addition, if you use Spring Security with Vaadin, we probably want to have access to the user’s security context to authorize push updates before they get dispatched to the client’s browser.