You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
984 B
33 lines
984 B
'use strict';
|
|
|
|
var inherits = require('inherits')
|
|
, AjaxBasedTransport = require('./lib/ajax-based')
|
|
, XhrReceiver = require('./receiver/xhr')
|
|
, XDRObject = require('./sender/xdr')
|
|
;
|
|
|
|
// According to:
|
|
// http://stackoverflow.com/questions/1641507/detect-browser-support-for-cross-domain-xmlhttprequests
|
|
// http://hacks.mozilla.org/2009/07/cross-site-xmlhttprequest-with-cors/
|
|
|
|
function XdrStreamingTransport(transUrl) {
|
|
if (!XDRObject.enabled) {
|
|
throw new Error('Transport created when disabled');
|
|
}
|
|
AjaxBasedTransport.call(this, transUrl, '/xhr_streaming', XhrReceiver, XDRObject);
|
|
}
|
|
|
|
inherits(XdrStreamingTransport, AjaxBasedTransport);
|
|
|
|
XdrStreamingTransport.enabled = function(info) {
|
|
if (info.cookie_needed || info.nullOrigin) {
|
|
return false;
|
|
}
|
|
return XDRObject.enabled && info.sameScheme;
|
|
};
|
|
|
|
XdrStreamingTransport.transportName = 'xdr-streaming';
|
|
XdrStreamingTransport.roundTrips = 2; // preflight, ajax
|
|
|
|
module.exports = XdrStreamingTransport;
|