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:
- (good one): browser smart : understand ajax same url won't stack ajax call until current call finished.
- browser understand ajax same url , make
abort()
on ajax 1st call , start new 1 (if browser that, rubbish in mind). - (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
Post a Comment