views:

4522

answers:

8

How can I implement Comet / Server push in Google App Engine in Python?

A: 

This is not a simple question to answer. Reading this wiki might give you a hint as to the implementation you'd like to undertake. You might have to write the HTTP server yourself to implement sockets which remain open.

Ben S
I can't write my own HTTP server in Google apps
Lev
+8  A: 

At this time, I would rule out doing Comet in App Engine (any language). Comet is based on long-lived HTTP connections, and App Engine will time out any single connection in about 30 seconds or so at most; it's hard to conceive of a worse match!

Alex Martelli
+2  A: 

Comet (or something like it - XMPP API) is on the google app engine roadmap. For now, stay away.

http://code.google.com/appengine/docs/roadmap.html

mainsocial
this is not helpful, although already released, the appengine can be used to build chat bots with this API, but it still doesn not allow for long-polling
Bartosz Radaczyński
you're right. another server is needed to translate the client-side long polling to XMPP messages. the recently release tornado framework looks like a good option!
mainsocial
+3  A: 

I found this article which explains a sort of comet. It is not really but you can simulate realtime with it. It uses an external service

http://www.brightyellowcow.com/blog/Comet-AJAX-push-using-PHP-or-Google-App-Engine.html

Alfred
A: 

30 seconds is more than enough,either way you should return a no-op message when a time passed a no new events occur,this prevents client timeouts and is done by everybody who does comet. just send the request,in the server make it wait until a event or timeout after 25 seconds.

Uriel Katz
+31  A: 

We just announced the Channel API to do comet push with App Engine apps: http://googleappengine.blogspot.com/2010/05/app-engine-at-google-io-2010.html

If you're at Google IO, I'll be talking about this at 1pm tomorrow (on the APIs track): http://code.google.com/events/io/2010/sessions/building-real-time-apps-app-engine-feed-api.html

Here's the YouTube video of the session: http://www.youtube.com/watch?v=oMXe-xK0BWA

Moishe
I'm sorry I had to miss that talk yesterday (too many good overlapping talks!). Any news on when we'll see documentation of this feature or when it'll be available for us to use?
npdoty
The talk itself will be on YouTube next week (I think), and it contains details of the API. No specific dates for launch, but if you want to sign up for trusted tester you can go do so here: https://spreadsheets.google.com/viewform?formkey=dGFxQ1A4T1BSYWxNdFlYVFhUcmg2amc6MQ
Moishe
Could you please link to the video?
TTT
As soon as the videos are posted to the Google IO site, I'll post a link here. (I am simultaneously looking forward to and dreading seeing myself on video...)
Moishe
Wondering if you could give us an estimate when we can play with this :)?
Alfred
+1  A: 

I would have commented on Moishe's answer , however my reputation doesn't seem to allow that... Here's that video to the Google I/O talk that describes the Channel API (only available to trusted developers for the moment, soon to be out)

http://www.youtube.com/watch?v=oMXe-xK0BWA

Conrado
I've been invited to use the pubsubhubbub Feed API v2, by Google. It is now in closed beta.The docs and signup form are here: http://code.google.com/apis/feed/push/
Conrado
A: 

Looking inside the App Engine 1.3.8-pre release, I see the Channel API service stub and more code. So it looks like we can start trying it out locally.

kvdb