Chrome’s loading indicator keeps spinning during XMLHttpRequest

I shamelessly stole Oleg’s test case and adjusted it a bit to simulate long-polling. load.html: <!DOCTYPE html> <head> <title>Demonstration of the jQery.load problem</title> <script src=”http://code.jquery.com/jquery-latest.js”></script> <script> jQuery(document).ready(function() { $(‘#main’).load(“test.php”); }); </script> </head> <body> <div id=’main’></div> </body> </html> test.php: <?php sleep(5); ?> <b>OK!</b> The result is interesting: in Firefox and Opera, no loading indicator is shown … Read more

How does a WCF server inform a WCF client about changes? (Better solution then simple polling, e.g. Comet or long polling)

It sounds to me like you already know the answer: use long polling. 🙂 So I guess the only thing left to explain is how you might be able to accomplish this with WCF and in the most efficient manner possible. The basics: First, decide how long you want each “long poll” to be. For … Read more

Non-Message Queue / Simple Long-Polling in Python (and Flask)

I’ve built several apps like this using just Flask and jQuery. Based on that experience, I’d say your plan is good. Do not use the filesystem. You will run into JavaScript security issues/protections. In the unlikely event you find reasonable workarounds, you still wouldn’t have anything portable or scalable. Instead, use a small local web … Read more

Chrome stalls when making multiple requests to same resource?

Yes, this behavior is due to Chrome locking the cache and waiting to see the result of one request before requesting the same resource again. The answer is to find a way to make the requests unique. I added a random number to the query string, and everything is working now. For future reference, this … Read more

What technology does Google Drive use to get real-time updates?

Is there a name for Google’s solution for real-time updates in Drive (such as “long polling” or “sockets”)? It didn’t have a name until now. I’ll call it “no-polling,” to contrast with polling and long-polling. With polling, the client periodically sends queries for new data. With long-polling, the client queries for data, and the server … Read more

jQuery read AJAX stream incrementally?

This is quite straightforward when outputting text or HTML. Below is an example. (You’ll run into issues if trying to output JSON however, which I’ll tackle further down.) PHP FILE header(‘Content-type: text/html; charset=utf-8’); function output($val) { echo $val; flush(); ob_flush(); usleep(500000); } output(‘Begin… (counting to 10)’); for( $i = 0 ; $i < 10 ; … Read more

Disable ajaxStart() and ajaxStop() for a specific request

I figured it out.. There is an attribute in the options object .ajax() takes called global. If set to false, it will not trigger the ajaxStart event for the call. $.ajax({ timeout: 35000, url: longPollUrl, success: function(data){ if(data.queCount) $(‘#numQueCount’).html(data.queCount); if(data.queAccept) $(‘#numQueAccept’).html(data.queAccept); }, global: false, // this makes sure ajaxStart is not triggered dataType: ‘json’, complete: … Read more

Short-polling vs Long-polling for real time web applications?

Just for the sake of argument. Both are http request (xhr), and its at least partially untrue it uses more server resources (depends totally on technology, will explain later). Short polling. Lot of request that are processed as they come on server. Creates a lot of traffic (uses resources, but frees them as soon as … Read more

tech