Flash-like hit counter with Ajax.
Posted: Mon Oct 08, 2007 4:16 pm
Well, I'm thinking of making a Flash-like hit count with Ajax. When I say "Flash-like" I mean a hit counter that updates live, without page refreshes.
So, I'm thinking of making HTTP calls to to get the new hit count in the database. But I don't want it to be slow, and I don't want it to be a performance issue. So what I'm wondering is how to do this right.
I was thinking of making an Ajax call every 5 or 10 seconds. But then if I get 100 view within those seconds it would just jump to more 100 views. This I don't want, because I want to emphasize the point that it's moving up rapidly.
So, if make calls every 10 seconds but then with jQuery have the hit count move gradually up to the new number in a period of 10 seconds.
This sounds like a great idea. But is it a performance issue or do you have a better solution?
So, I'm thinking of making HTTP calls to to get the new hit count in the database. But I don't want it to be slow, and I don't want it to be a performance issue. So what I'm wondering is how to do this right.
I was thinking of making an Ajax call every 5 or 10 seconds. But then if I get 100 view within those seconds it would just jump to more 100 views. This I don't want, because I want to emphasize the point that it's moving up rapidly.
So, if make calls every 10 seconds but then with jQuery have the hit count move gradually up to the new number in a period of 10 seconds.
This sounds like a great idea. But is it a performance issue or do you have a better solution?