Adriano
Adriano

Reputation: 73

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 client side i'm using GAE Channel API .

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

Upvotes: 2

Views: 1060

Answers (2)

systempuntoout
systempuntoout

Reputation: 74104

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.

Upvotes: 1

Hurda
Hurda

Reputation: 4715

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

Upvotes: 0

Related Questions