I'm using Google App Engine, Python and JQuery. My application is similar to Twitter in that it allows users to publish messages/status updates. I want the home page to display live updates (just like Twitter's homepage) so that if a new message is开发者_Go百科 posted, it appears top on the list of my home page.
I'm looking for a design pattern to get started.
Have you seen the new channel api on GAE? it will basically abstract away the polling - allowing you to push bi-directionally. Oh, and i've linked to the code sample (in Python + JS).
Hope this helps
On Google App Engine, you probably want to use the new Channel API. It allows you to declare a channel on the server, using code which looks like:
token = channel.create_channel('my_key')
... and then on the client you can use something like ...
<script>
channel = new goog.appengine.Channel('{{ token }}');
socket = channel.open();
socket.onmessage = onMessage;
</script>
There's plenty of examples on Google's site.
There are various techniques out there, they are usually referred to as "Comet" or "Reverse Ajax". I don't know about your specific technologies, but that ought to get you on the right track.
http://en.wikipedia.org/wiki/Comet_%28programming%29
精彩评论