this seems to be the place where the timeout is set for individual XHR calls:
goog.net.XhrManager.prototype.handleAvailableXhr_
and you'll probably want to send the timeout in the send method: goog.net.XhrManager.prototype.send
you do get passed the id in the handleAvailableXhr_ and you pass in an id in the send, so for send you can do something like:
goog.net.XhrManager.prototype.send = function(
id,
url,
opt_method,
opt_content,
opt_headers,
opt_priority,
opt_callback,
opt_maxRetries, opt_timeout) {
goog.base(this, 'send', id, url,
opt_method,
opt_content,
opt_headers,
opt_priority,
opt_callback,
opt_maxRetries);
if(!this.timeouts_)
this.timeouts = {};
this.timeouts.id = opt_timeout;
}
you would then need to copy most of handleAvailableXhr_ and change the setting of timeout:
goog.net.XhrManager.prototype.handleAvailableXhr_ = function(id, xhrIo) {
var request = this.requests_.get(id);
// Make sure the request doesn't already have an XhrIo attached. This can
// happen if a forced abort occurs before an XhrIo is available, and a new
// request with the same id is made.
if (request && !request.xhrIo) {
this.addXhrListener_(xhrIo, request.getXhrEventCallback());
// Set properties for the XhrIo.
// Add a reference to the XhrIo object to the request.
request.xhrIo = request.xhrLite = xhrIo;
// Notify the listeners.
this.dispatchEvent(new goog.net.XhrManager.Event(
goog.net.EventType.READY, this, id, xhrIo));
// Send the request.
this.retry_(id, xhrIo);
// If the request was aborted before it got an XhrIo object, abort it now.
if (request.getAborted()) {
xhrIo.abort();
}
} else {
// If the request has an XhrIo object already, or no request exists, just
// return the XhrIo back to the pool.
this.xhrPool_.releaseObject(xhrIo);
}
};
the point of xhrManager is to use it's xhrPool so using several would defeat the purpose. Best to extend it to work the way you want