Skip to content

Instantly share code, notes, and snippets.

🇰🇪
.

James Ngugi ngugijames

🇰🇪
.
View GitHub Profile
@ngugijames
ngugijames / longPolling.js
Created Oct 28, 2015 — forked from jasdeepkhalsa/longPolling.js
Simple Long Polling Example with JavaScript and jQuery by Tian Davis (@tiandavis) from Techoctave.com (http://techoctave.com/c7/posts/60-simple-long-polling-example-with-javascript-and-jquery)
View longPolling.js
// Long Polling (Recommened Technique - Creates An Open Connection To Server ∴ Fast)
(function poll(){
$.ajax({ url: "server", success: function(data){
//Update your dashboard gauge
salesGauge.setValue(data.value);
}, dataType: "json", complete: poll, timeout: 30000 });
})();
You can’t perform that action at this time.