Package com.vaadin.flow.component.webnotification


@NullMarked package com.vaadin.flow.component.webnotification
Server-side access to the browser's Notifications API, which shows native operating system notifications while the application is open in a browser tab — for example to tell the user that a background job finished while they are looking at another tab or application.

Use WebNotification.onClick(component) to ask for permission when a component is clicked, WebNotification.permissionSignal() to observe whether notifications are allowed, and WebNotification.show(String) to show a notification.

Permission is requested through onClick rather than an ordinary server-side click listener because browsers only show the permission prompt while handling a genuine user gesture, which is no longer valid by the time a server round trip completes. Showing a notification once permission is granted needs no gesture and works from any server-side code, including background threads through UI.access.

This is not the same as com.vaadin.flow.component.notification .Notification, which shows a toast inside the page, nor as Web Push, which delivers messages through a service worker when the application is not open.