Question

I'm writing a web application using Python's twisted.web on the server side.

On the frontend side I would like to use Ajax for displaying real time updates of events which are happening in the server.

There are lots of information out there on how this can be done, so I realized I need to pick a javascript library that would make my life easier.

socket.io seems to be a good choice since it supports several browsers and transport mechanisms, but by reading their examples it seems it can only work with node.js?

So, does anyone know if it's possible to use socket.io with twisted.web? If so, any links for a good example/tutorial would be also welcome.

Was it helpful?

Solution

You need something server side to integrate with the socket.io script on the client side. The servers that I know that are written in Python and do this all use Tornado. You could look at an implementation like, Tornadio (https://github.com/MrJoes/tornadio) and see what methods and classes they used to hook Tornadio and Tornado together. This would give you a pretty good idea of how to integrate it with your twisted.web server.

We've just switched away from socket.io to sockJS (which is also compatible with Tornado) and have seen large performance improvements.

OTHER TIPS

You could try https://github.com/DesertBus/sockjs-twisted or if you need SocketIO for a specific reason, it wouldn't be difficult to port TornadIO2 to Cyclone. You might find interesting this issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top