Friday, July 1, 2011

Re: Django AJAX polling: Best practice?

On 30 June 2011 21:31, Shawn Milochik <shawn@milochik.com> wrote:
> This isn't a job for AJAX -- it's a job for Comet, which is tailor-made for
> your exact needs.

Yes. Have your clients subscribe to an update channel for the game
(you will probably need separate channels for each user, unless all
players have full information). Generate the delta when the update
happens and push it out to the relevant channel(s).

> Check out Hookbox. Here's a tutorial which can definitely get you started. I
> was able to learn enough from it to get a small sample working.
> http://charlesleifer.com/blog/writing-a-real-time-chat-app-using-hookbox-and-flask/

Hookbox is a great way to easily get something up and running with
Comet*, but be aware that the project looks sadly unloved at the
moment. I'd be pretty wary about using it in production. On the other
hand, it can't possibly be worse than polling.

Cheers,
Duane.

* shameless plug: especially if you use django-hookbox.

--
"I never could learn to drink that blood and call it wine" - Bob Dylan

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment