Q:

show notification after completable future succeed

I've got a method called showNotification that shows notification
public static void showNotification(UI ui, String notificationMessage) {
        Notification notification = new Notification(notificationMessage);
        notification.setStyleName("custom-notification");
        notification.show(ui.getPage());
}

And I've got a service that returns CompletableFuture. 
In my controller I created method
@Override
public CompletableFuture<?> startProcessing() {
    return processorService.start();
}

And on button click I want to show notification if start was successful. 
My buttonClick event looks like this
event -> {
    controller.startProcessing()
        .thenAccept(aVoid -> UI.getCurrent().access(() -> {
                showNotification(getUI(), "Started processing");
            })
        ).handle((aVoid, throwable) -> {
               showNotification(getUI(), "Failed to start processing");
            return aVoid;
        });
}

The problem is that until I invoke another event - like for example click on another button - it doesn't show notification.
What is the problem?

A:

You need to add @Push to your UI subclass to make the browser open a two-directional connection with the server. Without that, only the browser can initiate communication, and it only does that when there's some new event to send to the server.

