开发者

GWT + GAE python: frameworks for COMET & RPC

Let's say I want to use Google GWT on the client side and Google AppEngine Pyth开发者_开发百科on on the server side. Furthermore, I want to be able to use RPC calls to the server as well as performing COMET based exchanges.

What are my options in term of existing frameworks?


I found this by googling "gwt python": http://code.google.com/p/python-gwt-rpc/ -- it appears to be unsupported, since App Engine supports Java now.

And this, by googling "gwt comet": http://code.google.com/p/rocket-gwt -- which should work on your client-side to make hanging GETs to the server, which conceivably could be written in Python.

But I have to say, it's going to be a lot easier to do this if you just write the server-side in Java. GWT and Java were made for eachother, they belong together, and unless you've got some strong aversion to writing the server in Java, you should really consider it.

You could hack some solution together to make GWT and Python work together, but it could easily break in upcoming versions of GWT, meaning more work for you in the long run.

Just write the server in Java.


One year later, the new Channel API available in GAE allows this kind of persistent connections to avoid polling both in Java and Python.

"The Channel API creates a persistent connection between your application and Google servers, allowing your application to send messages to JavaScript clients in real time without the use of polling. This is useful for applications that are designed to update the user about new information immediately or where user input is immediately broadcast to other users. Some examples include collaborative applications, multi-player games, and chat rooms. In general, using Channel API is a better choice than polling in situations where updates can't be predicted or scripted, such as when relaying information between human users or from events not generated systematically."


App Engine doesn't currently support comet, because it doesn't support hanging-GETs (eg, long-running requests). If you want to do comet, you'll have to use an external service, or wait for Comet support in App Engine.


You can do it with the help of a tiny extra service (I host one for free):

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

The service's sole job is to provide a wake up to the client application, and it does this using a long polled ajax request. Your App engine application pokes the service via http when there is new data uploaded, which causes the client to wake up and go back to the app engine application for the new data.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜