angularjsnode.jssocket.io-1.0

get users notification by angularjs and nodejs socket.io


i have two login pages one for doctor and one for admin. here admin can add patients. if admin added no.of new patients doctor wants to get new notification after he logged in. suppose admin added 10 patients then doctor wants to see those no.of newly added patients in message box . like doctors has to understand by seeing that 10 number in message symbol. here am using socket.io , angularjs and nodejs.


Solution

  • First of all you need to make a connection using socket.io whenever a admin or doctor logs in just define the role(admin or doctor) while making the connection. Now whenever an Admin creates a new patient you need to emit an event to all the doctors that need to be notified. On the doctor's side keep listening to the new patient addition event using socket.io's 'on' method and display the notification thereafter. Also keep saving the notifications in the DB to show the count.