I am not sure if I understand your question fully. However, I will write about how notification system works on Hashnode briefly so that you will get some idea.
Assuming you are using Node.js, one of your servers will trigger a notification. You should have a different notification server whose job is to notify the connected clients that a new notification has been generated. Both of these servers will ideally communicate via a message queue.
Once your front end app loads, it will open a Socket.io connection with your notification server. The notification server also uses Socket.io and stores the connected clients. When it receives a message from your Node server it should check who the recipient is. The next step is looking up in the connected clients list and finding out the particulat recipient socket. Once you have that you can emit an event via socket.io which is caught by the frontend app.
On the client side, when you receive a message via Socket.io it is just a matter of incrementing notification count.
Hope this helps. Let me know if you need further help.