Transport detection: close pending websockets
This commit is contained in:
parent
cca91d245f
commit
41c8024956
@ -57,7 +57,17 @@ export class MTTransportController extends EventListenerBase<{
|
||||
socket.setAutoReconnect(false);
|
||||
socket.connection.addEventListener('close', () => websocketPromise.resolve(false), {once: true});
|
||||
socket.connection.addEventListener('open', () => websocketPromise.resolve(true), {once: true});
|
||||
setTimeout(() => websocketPromise.resolve(false), timeout);
|
||||
setTimeout(() => {
|
||||
if(websocketPromise.isFulfilled || websocketPromise.isRejected) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(socket.connection) {
|
||||
socket.connection.close();
|
||||
}
|
||||
|
||||
websocketPromise.resolve(false);
|
||||
}, timeout);
|
||||
|
||||
const [isHttpAvailable, isWebSocketAvailable] = await Promise.all([httpPromise, websocketPromise]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user