From ae9e6a768225589055912662d5fb19b00c2599ea Mon Sep 17 00:00:00 2001 From: Eduard Kuzmenko Date: Fri, 1 Jul 2022 17:17:16 +0200 Subject: [PATCH] Fix using WebSockets on Safari --- src/lib/mtproto/dcConfigurator.ts | 4 ++-- webpack.common.js | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/mtproto/dcConfigurator.ts b/src/lib/mtproto/dcConfigurator.ts index 518a59cc..68dfb581 100644 --- a/src/lib/mtproto/dcConfigurator.ts +++ b/src/lib/mtproto/dcConfigurator.ts @@ -25,7 +25,7 @@ import { IS_WEB_WORKER } from '../../helpers/context'; import { DcId } from '../../types'; import { getEnvironment } from '../../environment/utils'; -/// #if !MTPROTO_SW +/// #if !MTPROTO_SW && SAFARI_PROXY_WEBSOCKET import SocketProxied from './transports/socketProxied'; /// #endif @@ -72,7 +72,7 @@ export class DcConfigurator { const retryTimeout = connectionType === 'client' ? 10000 : 10000; let oooohLetMeLive: MTConnectionConstructable; - /// #if MTPROTO_SW + /// #if MTPROTO_SW || !SAFARI_PROXY_WEBSOCKET oooohLetMeLive = Socket; /// #else oooohLetMeLive = (getEnvironment().IS_SAFARI && IS_WEB_WORKER && typeof(SocketProxied) !== 'undefined') /* || true */ ? SocketProxied : Socket; diff --git a/webpack.common.js b/webpack.common.js index 5e617dc3..47500022 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -31,6 +31,7 @@ const opts = { MTPROTO_AUTO: MTPROTO_AUTO, // use HTTPS when WS is unavailable MTPROTO_HAS_HTTP: MTPROTO_AUTO || MTPROTO_HTTP, MTPROTO_HAS_WS: MTPROTO_AUTO || !MTPROTO_HTTP, + SAFARI_PROXY_WEBSOCKET: false, DEBUG: devMode, version: 3,