In this video, Marcus Hellberg shows you how you can send web push notifications from a Java server. The video shows how to subscribe to notifications in the browser, save the subscription on the server, and use the subscription to send a web push notification.
The video uses a SpringBoot and Lit-based Vaadin Fusion project as an example, but you can use the same library in other environments.
You can find a text version of the content here https://dev.to/marcushellberg/how-to-...
0:00 - Intro
2:26 - How web push notifications work
4:12 - Using the Java WebPush library and setting up VAPID keys
5:29 - Storing subscriptions on the server
5:51 - Sending a web push notification from Java
6:28 - Creating an endpoint for communicating with the browser
7:34 - Subscribing to push notifications in the browser
8:44 - Checking to see if a user already has a subscription
9:20 - Requesting permission to show notifications and subscribing to the push server
13:45 - Handling an incoming push notification in the browser ServiceWorker
14:30 - Opening or focusing the application window on notification click
16:10 - Closing remarks
GitHub: https://github.com/marcushellberg/hil...
Java WebPush library: https://github.com/web-push-libs/webp...
Hilla: https://hilla.dev