开发者

How to make a countdown timer on appengine?

I am developing an application (on GAE) that needs a countdown timer and notifies the client side when the timer reaches zero.

To notify the c开发者_运维问答lient side i'm using GAE Channel API .

any ideas? (Considering GAE limitations. not using Thread or Timer from Java API).


I don't know how much reliability/precision you need, anyway here are a couple of ideas:

  1. After saving the server local time on memcache with the respective client ID, send a "timer-start" message to the client through the Channel API handling it client-side via some Javascript counter. When the timer is over or client has completed its duties , call the server and do your business logic.

  2. Use the countdown parameter of the TaskQueue, and before sending the "timer start" message to the client, add a task with a given countdown. The added task after n seconds will be triggered and should send the "timer-over" message to the client.


Can't you just poll for the information from client side? Or you can make cron task that run's once a minute and send appropriate message.

depends on how often do you need to do this, whta prcision you need

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜