25

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

Lev
  • 5,897
  • 5
  • 24
  • 29

6 Answers6

69

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

Hopefully last update! This is now released: code.google.com/appengine/docs/python/channel

crizCraig
  • 7,169
  • 4
  • 46
  • 50
Moishe Lettvin
  • 8,422
  • 1
  • 24
  • 38
  • 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 May 22 '10 at 00:44
  • 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 Lettvin May 23 '10 at 19:02
  • Could you please link to the video? – Alon Gubkin May 26 '10 at 16:50
  • 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 Lettvin May 27 '10 at 16:59
  • 3
    Wondering if you could give us an estimate when we can play with this :)? – Alfred Jun 21 '10 at 09:25
  • 1
    Dotting i's and crossing t's... look for this very soon. – Moishe Lettvin Nov 01 '10 at 23:36
3

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
  • 762,786
  • 156
  • 1,160
  • 1,345
2

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
  • 6,273
  • 3
  • 21
  • 24
  • 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 Sep 09 '09 at 20:23
  • 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 Sep 12 '09 at 00:17
1

30 seconds is more than enough; either way you should return a no-op message when a time passed and no new events occur.

This prevents client timeouts and is done by everybody who does comet.

Just send the request, and on the server make it wait until an event or timeout after 25 seconds.

Uriel Katz
  • 167
  • 1
  • 2
  • 9
0

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
  • 715
  • 6
  • 18
0

Google App Engine supports server push using the Channel API since 2nd December.

Robber
  • 399
  • 2
  • 14