Using ZeroMQ in a web application: how the interface interacts with the backend

I have heard some facts about ZeroMQ, and I think this is a very powerful thing. But now I'm trying to imagine how this can be applied in a web application.

Could you give an example of using ZeroMQ in web applications?

So the first thing that amazes me is a simple chat application. So, we need interfaces and a backend. I prefer using python + Tornado as a backend. There is python lib to use ZeroMQ. It is clear. So the next thing is the interface. In the interface, I will use some javascript to interact with the backend.

So, to do this, I have to use ajax calls, right? Are there any other ways to do this?

TIA!

+7
source share
1 answer

The easiest way to do this is to map WebSockets to ZeroMQ sockets, which is pretty simple with tornado and PyZMQ ZMQStream objects. An example of such an application is IPython Notebook . This approach has the drawback of having to use web maps, which limits the browsers that you can support. Of course, you can also display ajax calls using jQuery, etc. And process relays using asynchronous tornado handlers.

A more complex network: ZeroMQ is a mongrel2 web server.

The right choice for you just depends on your communication patterns.

+3
source

All Articles