What do you use to implement the notifications feature in your app?

I try to add a notification system on a personal app that I'm working on during this period of containment due to covid-19 :D. I tried websocket (first time I use it and I'm not sure if it is the best solution or not) but I just have some thoughts and question or doubt and I want to share them with you in order to correct me if I'm wrong or give me better suggestions. So the context of the app: a user can create a case by filling a form and an officer receives a list of affected cases. Whenever the officer finished a case, he should update the case's status and a notification will be send to the user.

I tried websocket and I send a notification to the client whenever the case's status changed. The user when clicks on the notification icon, he is able to see the list of notification and clears the list. But the problem I face now that, whenever I refresh the page, the same notification displayed again and it is due to the server who broadcasts the message whenever there is a connection.

  • How can server send message to a given client? and when the client receives the message should I close the connection or send a message to the server to clear a buffer to not receive the same notification again and again in the list whenever I refresh the page?

  • Is it the good solution to use websocket in this case or I create a table contains the notifications and make a node.js cron which queries the table to get notification according to the connected client?

  • If you are using notification system or did use it before what library or approach did/do you use?

PS: technologies I use are node.js and react.js

Thanks for your time and any suggestion will be welcome.

Learn Something New Everyday,
Connect With The Best Developers!

Sign Up Now!

& 500k+ others use Hashnode actively.

Comments (1)

slim's photo

Sandeep Panda Can you share with us, how you designed the notification system in hashnode and what are the things to take into consideration when trying to design it?

Want to read more?

Browse featured discussions

© 2020 · Hashnode