使用 Python 在 Google App Engine 中实现 Comet / Server 推送
如何使用 Python 在 Google App Engine 中实现 Comet / Server 推送?
How can I implement Comet / Server push in Google App Engine in Python?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
自 12 月 2 日起,Google App Engine 支持使用 Channel API 进行服务器推送。
Google App Engine supports server push using the Channel API since 2nd December.
30秒绰绰有余; 无论哪种方式,当一段时间过去并且没有新事件发生时,您都应该返回一条无操作消息。
这可以防止客户端超时,并且由所有使用 comet 的人完成。
只需发送请求,并在服务器上让它等待,直到 25 秒后发生事件或超时。
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.
查看 App Engine 1.3.8 预发行版的内部,我看到了 Channel API 服务存根和更多代码。 所以看来我们可以开始在本地尝试了。
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.
Comet(或类似的东西 - XMPP API)位于谷歌应用程序引擎路线图上。 现在,请远离。
http://code.google.com/appengine/docs/roadmap.html
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
目前,我排除在 App Engine(任何语言)中使用 Comet 的可能性。 Comet 基于长期 HTTP 连接,App Engine 最多会在大约 30 秒左右的时间内使任何单个连接超时; 很难想象还有比这更糟糕的匹配了!
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!
我们刚刚发布了使用 App Engine 应用进行彗星推送的 Channel API:http://googleappengine.blogspot.com/2010/05/app-engine-at-google-io-2010.html
如果您在 Google IO,我会谈论这个明天下午 1 点(在 API 轨道上):http://code.google.com/events/io/2010/sessions/building-real-time-apps-app-engine-feed-api.html
这是 YouTube 视频会议内容:http://www.youtube.com/watch?v=oMXe-xK0BWA希望
最后一次更新! 现已发布:code.google.com/appengine/docs/python/channel
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