I am wondering on how to implement user notifications just like facebook does on its site. At the moment I am calling a php script using angular timer which tells me if any notification is available in the database. Is there any technique that I can use to push notifications to angular code?
Asked
Active
Viewed 389 times
0

Nikolay Fominyh
- 8,946
- 8
- 66
- 102

Syed Rizwan Ali
- 233
- 2
- 19
-
It sounds like you have implemented polling. You can look into sockets if you want real-time communication from server to web browser. – MonkeyZeus Feb 20 '17 at 19:23
-
There are two browser APIs that can receive event-driven responses without having to poll the server: [EventSource Web API](https://developer.mozilla.org/en-US/docs/Web/API/EventSource) and [WebSockets Web API](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API). – georgeawg Feb 20 '17 at 20:17
-
See [WebSockets vs. Server-Sent events/EventSource](http://stackoverflow.com/questions/5195452/websockets-vs-server-sent-events-eventsource). – georgeawg Feb 20 '17 at 20:27