Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Lame question: What techniques are used to show real-time stats like that on a web page? I assume those are truly real-time, anyway.

I'm no web developer, but this feature really strikes me as cool in this particular instance. I rarely fancy overly-busy web pages, but these stats seem very nicely executed; interesting in and of themselves, yet clean and nice visual presentation.



They are using some form of AJAX (JavaScript talking directly to their server without reloading the page).

In this case they appear to be using PubNub. http://www.pubnub.com/how-it-works


They're constantly requesting a JSON file about once a second. Example contents, formatted: http://pastebin.com/uMv7d8xS


Seems like excessive transfers. I achieved a "real time" counter by having requests return a start value and a rate of change per second. The GUI would then update every second with the estimated values. My AJAX requests would happen much less often and update the start and rate of change.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: