javascript - Multiple Ajax Requests to Node.js timing out -
i have unique setup, imagine having effect on issue (which i've never seen before).
i'm writing google chrome extension, , i'm relying on node.js backend.
when run multiple ajax requests, , node.js takes long time respond (for instance, 2.5 seconds) of ajax requests never receive response , throw error.
i've set test function in node.js server respond json object after waiting 2500 ms. i've confirmed works single request.
then, i've tried embedding jquery in extension , trying 2 requests:
(function(){ $.ajax({ url : url, data : params, type : "post", success : function(data){ alert('success1'); }, error : function(xmlhttprequest, textstatus, message) { alert('error'); } }); })(); (function(){ $.ajax({ url : url, data : params, type : "post", success : function(data){ alert('success2'); }, error : function(xmlhttprequest, textstatus, message) { alert('error'); } }); })();
in case, second alert called. first 1 result in error (timeout).
i tried without jquery, so:
var xhr = new xmlhttprequest(); xhr.open("post", url, true); xhr.onreadystatechange = function() { alert('response1'); } xhr.send(); var xhr2 = new xmlhttprequest(); xhr2.open("post", url, true); xhr2.onreadystatechange = function() { alert('response2'); } xhr2.send();
in case, both of requests fail; don't receive response either one.
i've tried code in background script, running on auto generated background page. fails (neither success works).
i'm guessing related in way niche case i'm writing here, @ point i'm @ standpoint how troubleshoot , move forward. ideas exploring issue further?
thanks! kevin
i have unique setup, imagine having effect on issue (which i've never seen before). i'm writing google chrome extension, , i'm relying on node.js backend. when run multiple ajax requests, , node.js takes long time respond (for instance, 2.5 seconds) of ajax requests never receive response , throw error. i've set test function in node.js server respond json object after waiting 2500 ms. i've confirmed works single request. then, i've tried embedding jquery in extension , trying 2 requests: in case, second alert called. first 1 result in error (timeout). i tried without jquery, so: in case, both of requests fail; don't receive response either one. i've tried code in background script, running on auto generated background page. fails (neither success works). i'm guessing related in way niche case i'm writing here, @ point i'm @ standpoint how troubleshoot , move forward. ideas exploring issue further? thanks! kevin | |||||||||||||
|