javascript - how to deal with slow Ajax request / people with slow connection -


here 'hypothetical' situation.

let's have : websocket tell's me send ajax on url http://localhost/whatever every 10 sec.

the ajax call on http://localhost/whatever take 45 seconde reply (exagerate number situation).

i wonder how browser react? in mind 3 case:

  1. (good one): browser smart : understand ajax same url won't stack ajax call until current call finished.
  2. browser understand ajax same url , make abort() on ajax 1st call , start new 1 (if browser that, rubbish in mind).
  3. (worst case): browser send ajax on url each time websocket ask him , wait answer. moreover, suppose there problem limitation of parralel ajax request? (i wonder how browser if case happens ?)

so, case happen , why ?

the answer case 3.

the browser send requests in order make them. speaking computer carry out instructions in order issue them. if want or need special behavior such throttling rate of requests or not sending subsequent requests until prior ones have finished need implement self.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -