To update client web app of notifications?

Can i avoid putting a timed event from client app which pings server, for event updates?

I am using Angularjs, Nodejs-expressjs, to build my web app.

The other alternative i can think of maybe

Can i do something like'/abc', function(req, res){
   res.send('event data');

The above will not return till the event happens.


There are multiple ways to implement push notifications:

HTTP Long Polling : The client initiates a request. The server checks if it has any new notifications. Irrespective of whether or not it has new notifications appropriate response is send and connection is closed. After time X client initiates another request (+ Very easy to implement - notifications are not real time. They depend on X since data retrieval is client initiated. As X decreases overhead on server increases )

HTTP Streaming: This is very similar to HTTP Long Polling however the connection is not closed. The server sends chunked response. So as soon as server receives new notification that it wants to push it can simply write to the socket. ( + lower latency than long polling and almost real time behaviour / overhead of closing connection and re opening reduced - memory usage client side keeps on piling up / ugly hacks etc )

WebSocket: TCP based protocol provides true two way communication. The server can push data to client any time. ( + ve: true real time - some older browsers dont support it ). Read more about it | About WebSocket

Now based on the technology stack there are various solutions available: (A) Nodejs : the cross-browser WebSocket for realtime apps. ( does heavy lifting for you. Gracefully falls back in case websocket is not supported ) (B) Django : As mentioned previously you can use signals for notifications. Also you can try django-websocket 0.3.0 for supporting websocket (C) Jetty / Netty and Grizzly (Java based) : All have websocket support

from link

Need Your Help

Can I put an http psw on a site and still let Facebook REALTIME apis through?

http authentication facebook-graph-api facebook

I'm working on a site that is using Facebook authentication and friends, but I'm not ready for it to be publicly visible. It seems like if I put a password on the site's directory, Facebook's calls...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.