Skip to content

Instantly share code, notes, and snippets.

View andrewstobbe's full-sized avatar

Andrew Stobbe andrewstobbe

  • Parker, Colorado
View GitHub Profile
@andrewstobbe
andrewstobbe / longPolling.js
Created March 25, 2016 17:34 — 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)
// 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 });
})();