ravi
ravi

Reputation: 838

How to deal with channel api rate limit?

I need to implement real time notification system like stackoverflow(when someone adds answer/comment to a question) to my website. I came to know that channel API is the easiest way to implement that on appengine. But i was taken back by the quota limits for channel API. Only 60 tokens/min can be created when you enable billing.

Upvotes: 2

Views: 537

Answers (1)

Sologoub
Sologoub

Reputation: 5352

Channel API seems like overkill for simplistic use case of notifying someone that an answer for the question they are looking at has been added. It seems like Channel API would be better suited for use cases where a few seconds delay would cause undesirable consequences.

If all you need to do is update users every few seconds that something has happened to the content they are looking at, you can probably just go with the most basic short polling approach.

Something like this on page:

function doPoll(){
    $.post('ajax/test.html', function(data) {
        alert(data);  // process results here
        setTimeout(doPoll,5000);
    });
}

Source: jQuery, simple polling example

Whenever a change is made, load it into memcache. The post to "ajax/test.html" would go to a handler that should check memcache for any updates. This way you are not hitting datastore.

Upvotes: 4

Related Questions