6

How should I implement reverse AJAX when building a chat application in Django? I've looked at Django-Orbited, and from my understanding, this puts a comet server in front of the HTTP server. This seems fine if I'm just running the Django development server, but how does this work when I start running the application from mod_wsgi? How does having the orbited server handling every request scale? Is this the correct approach?

I've looked at another approach (long polling) that seems like it would work, although I'm not sure what all would be involved. Would the client request a page that would live in its own thread, so as not to block the rest of the application? Would it even block? Wouldn't the script requested by the client have to continuously poll for information?

Which of the approaches is more proper? Which is more portable, scalable, sane, etc? Are there other good approaches to this (aside from the client polling for messages) that I have overlooked?

Carson Myers
  • 37,678
  • 39
  • 126
  • 176

3 Answers3

1

Have take a look at Tornado?

Using WSGI for comet/long-polling apps is not a good choice because don't support non-blocking requests.

byterussian
  • 3,539
  • 6
  • 28
  • 36
1

How about using the awesome nginx push module?

Steve Jalim
  • 11,989
  • 1
  • 37
  • 54
0

The Nginx Push Stream Module provides a simple HTTP interface for both the server and the client.

The Nginx HTTP Push Module is similar, but seems to no longer be maintained.

Vebjorn Ljosa
  • 17,438
  • 13
  • 70
  • 88