index.js 691 B

12345678910111213141516171819202122232425
  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. const webtransport_1 = require("./webtransport");
  7. exports.default = {
  8. polling: polling,
  9. websocket: websocket_1.WebSocket,
  10. webtransport: webtransport_1.WebTransport,
  11. };
  12. /**
  13. * Polling polymorphic constructor.
  14. *
  15. * @api private
  16. */
  17. function polling(req) {
  18. if ("string" === typeof req._query.j) {
  19. return new polling_jsonp_1.JSONP(req);
  20. }
  21. else {
  22. return new polling_1.Polling(req);
  23. }
  24. }
  25. polling.upgradesTo = ["websocket", "webtransport"];