Reputation: 31
My requirement is to make 20 rest API calls on click of a button. When I inspect, I can see chrome only allows max 6 concurrent calls and put other APIs in a stack. I'm using $.ajax to make API calls. How can I overwrite the default limit of any browser?
Upvotes: 2
Views: 2303
Reputation: 2653
So should probably apply some form of orchestration. Create your own api/service that performs all the API calls that you want performed with one click of a button. Then have the button click call your own 'Proxy' API.
Upvotes: 2
Reputation: 1074335
You can't. The browser sets the limit. There is no API to attempt to change that limit. You can start as many calls as you like, but the browser will only process as many as it allows. This is largely transparent to your code, other than (of course) that you won't see a completion of one of the calls that queued until after at least one of the earlier ones has completed.
Note that the limit is typically different for different devices. I haven't checked it lately, but it used to be 6-8 for most desktop browsers but only 2 for the "same" browser on mobile.
Upvotes: 4