Last change
on this file since 59329aa was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
474 bytes
|
Line | |
---|
1 | const XHR = require("./polling");
|
---|
2 | const JSONP = require("./polling-jsonp");
|
---|
3 |
|
---|
4 | /**
|
---|
5 | * Export transports.
|
---|
6 | */
|
---|
7 |
|
---|
8 | module.exports = exports = {
|
---|
9 | polling: polling,
|
---|
10 | websocket: require("./websocket")
|
---|
11 | };
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * Export upgrades map.
|
---|
15 | */
|
---|
16 |
|
---|
17 | exports.polling.upgradesTo = ["websocket"];
|
---|
18 |
|
---|
19 | /**
|
---|
20 | * Polling polymorphic constructor.
|
---|
21 | *
|
---|
22 | * @api private
|
---|
23 | */
|
---|
24 |
|
---|
25 | function polling(req) {
|
---|
26 | if ("string" === typeof req._query.j) {
|
---|
27 | return new JSONP(req);
|
---|
28 | } else {
|
---|
29 | return new XHR(req);
|
---|
30 | }
|
---|
31 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.