Because of the increase in the usage of smartphones, mobile push notifications have higher engagement when compared to desktop push notifications.
For mobile push notifications to work, the user has to accept the opt-in on the mobile browser when they visit the website. Now, when a website sends push notifications to its users, the push service adds the notification to the queue. It checks with the service worker file and sends push messages to the subscribers.
Know more about the service worker file to know how push notifications work.