xdr-polling.js 712 B

1234567891011121314151617181920212223
  1. 'use strict';
  2. var inherits = require('inherits')
  3. , AjaxBasedTransport = require('./lib/ajax-based')
  4. , XdrStreamingTransport = require('./xdr-streaming')
  5. , XhrReceiver = require('./receiver/xhr')
  6. , XDRObject = require('./sender/xdr')
  7. ;
  8. function XdrPollingTransport(transUrl) {
  9. if (!XDRObject.enabled) {
  10. throw new Error('Transport created when disabled');
  11. }
  12. AjaxBasedTransport.call(this, transUrl, '/xhr', XhrReceiver, XDRObject);
  13. }
  14. inherits(XdrPollingTransport, AjaxBasedTransport);
  15. XdrPollingTransport.enabled = XdrStreamingTransport.enabled;
  16. XdrPollingTransport.transportName = 'xdr-polling';
  17. XdrPollingTransport.roundTrips = 2; // preflight, ajax
  18. module.exports = XdrPollingTransport;