Abdelouahab
Abdelouahab

Reputation: 7539

Real-time notification using Python

First there is TornadoWeb, it's async and non-blocking, and on the other side: there is Dojo. If I use tornado, how can I communicate with dojo?

And the other problem, if I use a WSGI solution like Flask, can I make a "notification" with them? Or dojo must have an "open connection" to speak with the server, which is not done using WSGI? mean; Apache or CherryPy will not work with Dojo?

And if WSGI can't speak with Dojo, what about using Atom or Feeds to program notifications under WSGI?

NB: the notification will be devided on two: notification about products for all users, and notification about specific users; it will use sessions...

And last question, what about WebSockets and HTML5? the server must be compatible to use this option with the browser?

Upvotes: 3

Views: 3190

Answers (1)

Juliusz Gonera
Juliusz Gonera

Reputation: 4958

I'm not sure why Dojo seems to be the problem in the communication.

Dojo provides you with AJAX wrappers which you can use for almost real-time notifications in a web app with little load by making an AJAX request each 1-5 seconds.

If the app will have a lot of users, frequent AJAX requests can cause too much overhead quickly. Fortunately, you don't have to use Dojo to communicate with the server. You could have a look at Socket.IO and, if you want to stick to Python on the server-side, gevent-socketio. It uses the best technology available in the web browser (WebSockets, Flash sockets, comet) to provide real-time communication.

There is also dojox.socket but I think it's less robust (and far less popular).

You should remember, however, that by using any kind of persistent connection (be it WebSockets, Socket.IO or dojox.socket) you need an asynchronous server able to maintain many simultaneous connections.

The solution you choose should depend on the web app itself and its user base.

Upvotes: 3

Related Questions