Django DRF / JS - React Notifications API

Viewed 292

I am working on a browser extension with a Django DRF backend and currently JS frontend ( working to convert it to React ). What I am trying to achieve is when a user clicks a buttons to trigger the Notification API for a set of users. Reading about this I have found some solutions:

  1. Websockets - currently the API is WSGI, seen that in order to add ASGI I need to change pretty much the entire foundation of my app or can I just hook up a different module that can talk to WSGI side? Sorry not very confident that I understand how this actually some clarification would be awesome. Also if for example you have 100 users with their channels open to the server how would that impact performace?
  2. The Super Hacky way - have an ajax/axios request that runs every 2 min or so and checks for DB changes, if true create the notification object. Again if you have 100 users pining the server constantly I assume performance will take a big hit
  3. Cron Job - would something like this work?

Could also have a signal, post_save do something but I am not sure how I can trigger a JS function for selected users. Sorry I am a bit over the place but not sure what the best path is in my scenario.

Thanks. Basically I just want to know what solutions are out there

0 Answers
Related