Push notifications have been popular with the features in mobile phone applications for the last few years. Regardless of whether you have an app opened, running in the foreground, or not running at all, push notifications will pop a message on your mobile phone. Similar to this, there is a new API available for the web called Push API, which is an experimental technology at the time of writing. In order to make Push API work, we need to have an active service worker running and must have subscribed to push notifications.
Let's start off this chapter by looking at how to implement a simple push notification.