Docs

Documentation versions (currently viewingVaadin 24)

Server Push

How to use server push in your user interfaces.

Server push is based on a client-server connection established by the client. The server can then use the connection to send updates to the client. For example, it could send a new chat message to all participants without delay.

The server-client communication uses a WebSocket connection, if supported by the browser and the server. If not, the connection resorts to whatever method is supported. Vaadin uses the Atmosphere framework, internally.

In Hilla views, push is always enabled when you subscribe to a reactive endpoint. For Flow views, you have to enable it, explicitly.

Important
Server push is not the same as Web Push, which is also supported by Vaadin Flow. For more information, see the Web Push Notifications documentation page.

Enabling Push Flow

Before you can use server push in Flow, you have to enable it. You do this by adding the @Push annotation to the application shell class, like this:

import com.vaadin.flow.component.page.AppShellConfigurator;
import com.vaadin.flow.component.page.Push;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@Push
public class Application implements AppShellConfigurator {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

Topics

Pushing
How to push updates to a Vaadin Flow user interface.
Threads
How to use threads in a Vaadin Flow user interface.
Callbacks
How to use server push with callbacks.
Futures
How to use server push with CompletableFuture.
Hilla Services
How to create reactive browser callable services for a Vaadin Hilla user interface.
Consuming Rective Streams
How to use server push with reactive streams.