AJAX - The Complete Reference

(avery) #1

250 Part II: Developing an Ajax Library^


request queue in depth can be found at http://ajaxref.com/ch6/requestqueueexplorer.html
and is demonstrated a bit in Figure 6-10.
Now, a more common issue is that even if requests go out in a particular order, that says
absolutely nothing about how they come back.

Order Is Not Guaranteed


The reality is that even if requests are issued in order, they may not come back in the same
order as they were sent. As previously shown, a request may get hung up and return much
later than expected. With the ability to issue at least two requests at a time, such problems
lead to the possibility of data being presented out of sequence. For example, take a look at
Figure 6-11, which uses the example found at http://ajaxref.com/ch6/sequence.html.
As shown in Figure 6-11, the message “Makes sense?” doesn’t appear properly every
time depending on request latency. No matter what the latency is for the requests, this
happens if you try it enough. The figure presented was actually three runs in a row
illustrating that on the Internet, responses don’t arrive in the order that may be expected
more often than you might think.

FIGURE 6-10 Queuing mechanisms can get complex
Free download pdf