github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/themes/wind/static/libs/sockjs-client-1.1.0/lib/transport/xdr-streaming.js (about) 1 'use strict'; 2 3 var inherits = require('inherits') 4 , AjaxBasedTransport = require('./lib/ajax-based') 5 , XhrReceiver = require('./receiver/xhr') 6 , XDRObject = require('./sender/xdr') 7 ; 8 9 // According to: 10 // http://stackoverflow.com/questions/1641507/detect-browser-support-for-cross-domain-xmlhttprequests 11 // http://hacks.mozilla.org/2009/07/cross-site-xmlhttprequest-with-cors/ 12 13 function XdrStreamingTransport(transUrl) { 14 if (!XDRObject.enabled) { 15 throw new Error('Transport created when disabled'); 16 } 17 AjaxBasedTransport.call(this, transUrl, '/xhr_streaming', XhrReceiver, XDRObject); 18 } 19 20 inherits(XdrStreamingTransport, AjaxBasedTransport); 21 22 XdrStreamingTransport.enabled = function(info) { 23 if (info.cookie_needed || info.nullOrigin) { 24 return false; 25 } 26 return XDRObject.enabled && info.sameScheme; 27 }; 28 29 XdrStreamingTransport.transportName = 'xdr-streaming'; 30 XdrStreamingTransport.roundTrips = 2; // preflight, ajax 31 32 module.exports = XdrStreamingTransport;