Ad

Sending Push Notifications To Web Application Without User Consent

I want to send push notifications to my web application users on the occurrence of certain events by updating an icon with a red dot. This is similar to Facebook updating the "notification bell" icon with a dot, on receiving a message or getting a new friend request

LINK TO EXAMPLE IMAGE

I have tried to send notifications to the web app, but it requires the user to "allow notifications" before sending it.

Note that, Facebook/Twitter or any other social media sites can notify users even if the user explicitly blocks all the notifications for the website.

Ad

Answer

Socket.io is quite handy for this. You can just listen/emit some events at both client and server and act accordingly (in your case, updating the "notification bell" icon)

Ad
source: stackoverflow.com
Ad