index.js 577 B

1234567891011121314151617181920212223
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const polling_1 = require("./polling");
  4. const polling_jsonp_1 = require("./polling-jsonp");
  5. const websocket_1 = require("./websocket");
  6. exports.default = {
  7. polling: polling,
  8. websocket: websocket_1.WebSocket
  9. };
  10. /**
  11. * Polling polymorphic constructor.
  12. *
  13. * @api private
  14. */
  15. function polling(req) {
  16. if ("string" === typeof req._query.j) {
  17. return new polling_jsonp_1.JSONP(req);
  18. }
  19. else {
  20. return new polling_1.Polling(req);
  21. }
  22. }
  23. polling.upgradesTo = ["websocket"];