()
| 2203 | var failed = false; |
| 2204 | SocketWithoutUpgrade.priorWebsocketSuccess = false; |
| 2205 | var onTransportOpen = function onTransportOpen() { |
| 2206 | if (failed) return; |
| 2207 | transport.send([{ |
| 2208 | type: "ping", |
| 2209 | data: "probe" |
| 2210 | }]); |
| 2211 | transport.once("packet", function (msg) { |
| 2212 | if (failed) return; |
| 2213 | if ("pong" === msg.type && "probe" === msg.data) { |
| 2214 | _this8.upgrading = true; |
| 2215 | _this8.emitReserved("upgrading", transport); |
| 2216 | if (!transport) return; |
| 2217 | SocketWithoutUpgrade.priorWebsocketSuccess = "websocket" === transport.name; |
| 2218 | _this8.transport.pause(function () { |
| 2219 | if (failed) return; |
| 2220 | if ("closed" === _this8.readyState) return; |
| 2221 | cleanup(); |
| 2222 | _this8.setTransport(transport); |
| 2223 | transport.send([{ |
| 2224 | type: "upgrade" |
| 2225 | }]); |
| 2226 | _this8.emitReserved("upgrade", transport); |
| 2227 | transport = null; |
| 2228 | _this8.upgrading = false; |
| 2229 | _this8.flush(); |
| 2230 | }); |
| 2231 | } else { |
| 2232 | var err = new Error("probe error"); |
| 2233 | // @ts-ignore |
| 2234 | err.transport = transport.name; |
| 2235 | _this8.emitReserved("upgradeError", err); |
| 2236 | } |
| 2237 | }); |
| 2238 | }; |
| 2239 | function freezeTransport() { |
| 2240 | if (failed) return; |
| 2241 | // Any callback called by transport should be ignored since now |
nothing calls this directly
no test coverage detected