Browse Source

Fix using WebSockets on Safari

master
Eduard Kuzmenko 3 years ago
parent
commit
ae9e6a7682
  1. 4
      src/lib/mtproto/dcConfigurator.ts
  2. 1
      webpack.common.js

4
src/lib/mtproto/dcConfigurator.ts

@ -25,7 +25,7 @@ import { IS_WEB_WORKER } from '../../helpers/context';
import { DcId } from '../../types'; import { DcId } from '../../types';
import { getEnvironment } from '../../environment/utils'; import { getEnvironment } from '../../environment/utils';
/// #if !MTPROTO_SW /// #if !MTPROTO_SW && SAFARI_PROXY_WEBSOCKET
import SocketProxied from './transports/socketProxied'; import SocketProxied from './transports/socketProxied';
/// #endif /// #endif
@ -72,7 +72,7 @@ export class DcConfigurator {
const retryTimeout = connectionType === 'client' ? 10000 : 10000; const retryTimeout = connectionType === 'client' ? 10000 : 10000;
let oooohLetMeLive: MTConnectionConstructable; let oooohLetMeLive: MTConnectionConstructable;
/// #if MTPROTO_SW /// #if MTPROTO_SW || !SAFARI_PROXY_WEBSOCKET
oooohLetMeLive = Socket; oooohLetMeLive = Socket;
/// #else /// #else
oooohLetMeLive = (getEnvironment().IS_SAFARI && IS_WEB_WORKER && typeof(SocketProxied) !== 'undefined') /* || true */ ? SocketProxied : Socket; oooohLetMeLive = (getEnvironment().IS_SAFARI && IS_WEB_WORKER && typeof(SocketProxied) !== 'undefined') /* || true */ ? SocketProxied : Socket;

1
webpack.common.js

@ -31,6 +31,7 @@ const opts = {
MTPROTO_AUTO: MTPROTO_AUTO, // use HTTPS when WS is unavailable MTPROTO_AUTO: MTPROTO_AUTO, // use HTTPS when WS is unavailable
MTPROTO_HAS_HTTP: MTPROTO_AUTO || MTPROTO_HTTP, MTPROTO_HAS_HTTP: MTPROTO_AUTO || MTPROTO_HTTP,
MTPROTO_HAS_WS: MTPROTO_AUTO || !MTPROTO_HTTP, MTPROTO_HAS_WS: MTPROTO_AUTO || !MTPROTO_HTTP,
SAFARI_PROXY_WEBSOCKET: false,
DEBUG: devMode, DEBUG: devMode,
version: 3, version: 3,

Loading…
Cancel
Save