Hi Rafael.

Create a class TimeHandlerChannel that has a list property "client_ids"
and other properties that you need, like the timer start time.


There should be only one instance of the this class. Store the instance
in memcache (eventually also in db). When a new user joins your game
(or whatever) you create a channel for this user-
channel.create_channel(client_id) - and save his client_id in the
TimeHandlerChannel client_ids property. The TimeHandlerChannel class
should also have a method "send_messages", where a message is send to
each client (for client in client_ids: channel.send_message(client,
time_left).


Then you create a taskqueue that runs every 10 seconds (or whatever
time you would like). This task uses the TimeHandlerChannel instance,
which is stored in memcache, to send the remaining time to all the
subscribed users via the send_messages method. Finally, add the task
again to the taskqueue, so that is runs again 10 seconds later.


Every 10 seconds the remaining time is pushed to all the users that are
using your game (client_ids that are added to the client_ids list of
the TimeHandlerChannel class)


Don't really on javascript. Always check on the server side if a user
is permitted to perfom an action (is the time already up?)


Regards,


Alexander

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to