-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JSONP polling was only used in IE7/8, which are not supported anymore. BREAKING CHANGE: the jsonp and forceJSONP options are removed.
- Loading branch information
1 parent
27de300
commit b2c7381
Showing
5 changed files
with
1 addition
and
289 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,7 @@ | ||
import * as XMLHttpRequestModule from "xmlhttprequest-ssl"; | ||
import { XHR } from "./polling-xhr.js"; | ||
import { JSONP } from "./polling-jsonp.js"; | ||
import { WS } from "./websocket.js"; | ||
|
||
const XMLHttpRequest = XMLHttpRequestModule.default || XMLHttpRequestModule; | ||
|
||
/** | ||
* Polling transport polymorphic constructor. | ||
* Decides on xhr vs jsonp based on feature detection. | ||
* | ||
* @api private | ||
*/ | ||
|
||
function polling(opts) { | ||
let xhr; | ||
let xd = false; | ||
let xs = false; | ||
const jsonp = false !== opts.jsonp; | ||
|
||
if (typeof location !== "undefined") { | ||
const isSSL = "https:" === location.protocol; | ||
let port = location.port; | ||
|
||
// some user agents have empty `location.port` | ||
if (!port) { | ||
port = isSSL ? "443" : "80"; | ||
} | ||
|
||
xd = opts.hostname !== location.hostname || port !== opts.port; | ||
xs = opts.secure !== isSSL; | ||
} | ||
|
||
opts.xdomain = xd; | ||
opts.xscheme = xs; | ||
xhr = new XMLHttpRequest(opts); | ||
|
||
if ("open" in xhr && !opts.forceJSONP) { | ||
return new XHR(opts); | ||
} else { | ||
if (!jsonp) throw new Error("JSONP disabled"); | ||
return new JSONP(opts); | ||
} | ||
} | ||
|
||
export const transports = { | ||
websocket: WS, | ||
polling | ||
polling: XHR | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters