angulardjango-notification

How to fetch and display real-time user notifications in angular?


I am working with django-notification and I am trying to fetch and display the notifications on my angular app. So how should I fetch the data from the backend to make it real-time? Should I periodically fetch data using something like setTimeout? or is there a better way to do this in angular?


Solution

  • you should have two departments ready to achieve this :-

    1. you should have web socket server api implemeted which will send the notification to the subscriber in application.
    2. you can use WebSocketSubject rxjs special kind of subject which will let you consume the web socket API,you can read more about this subject to following link.

      https://rxjs-dev.firebaseapp.com/api/webSocket/WebSocketSubject