title: Combine multiple GCM messages in AppEngine
body: <p>I have an Android app which uses Google Cloud Endpoints to synchronize data between devices. Currently in each api call a GCM message is send to all other devices. Often a devices does not only do one api call, but multiple directly after each other. In this situation it gets extremely inefficient to send a message in each call, because then all the other devices make multiple calls to get the new data instead of just one for all.</p>
  
  <p>So my idea is basically after an  api call wait ~10 seconds and then send a GCM message. Whenever a new call comes in and the timer gets resetted.</p>
  
  <p>My problem is I don't really know how to do this in AppEngine. My first idea was a TaskQueue with a task that is named a certain way and has a 10 second delay. In the API call I check if the task is in the queue and if yes I remove it and insert a new one. This wasn't possible because a taskname can't be used again even if the task doesn't exist anymore.</p>