diff --git a/packages/hms-video-store/src/analytics/HTTPAnalyticsTransport.ts b/packages/hms-video-store/src/analytics/HTTPAnalyticsTransport.ts index a0c9e61497..84f76d0076 100644 --- a/packages/hms-video-store/src/analytics/HTTPAnalyticsTransport.ts +++ b/packages/hms-video-store/src/analytics/HTTPAnalyticsTransport.ts @@ -1,12 +1,10 @@ import AnalyticsEvent from './AnalyticsEvent'; import { IAnalyticsTransportProvider } from './IAnalyticsTransportProvider'; -import { HMSProxyConfig } from '../interfaces'; import { CLIENT_ANAYLTICS_PROD_ENDPOINT, CLIENT_ANAYLTICS_QA_ENDPOINT, CLIENT_ANAYLTICS_STORAGE_LIMIT, } from '../utils/constants'; -import { getEndpointFromProxy } from '../utils/get-endpoint-from-proxy'; import { LocalStorage } from '../utils/local-storage'; import HMSLogger from '../utils/logger'; import { ENV } from '../utils/support'; @@ -41,15 +39,13 @@ class ClientAnalyticsTransport implements IAnalyticsTransportProvider { isConnected = true; private env: null | ENV = null; private websocketURL = ''; - private proxy?: HMSProxyConfig; setEnv(env: ENV) { this.env = env; this.flushFailedEvents(); } - setWebsocketEndpoint(ws: string, proxy?: HMSProxyConfig) { - this.proxy = proxy; + setWebsocketEndpoint(ws: string) { this.websocketURL = ws; } @@ -71,19 +67,13 @@ class ClientAnalyticsTransport implements IAnalyticsTransportProvider { }; const url = this.env === ENV.PROD ? CLIENT_ANAYLTICS_PROD_ENDPOINT : CLIENT_ANAYLTICS_QA_ENDPOINT; - const proxyUrl = getEndpointFromProxy(this.proxy); - const headers = { - 'Content-Type': 'application/json', - Authorization: `Bearer ${event.metadata.token}`, - user_agent_v2: event.metadata.userAgent, - 'Target-URL': url, - }; - if (proxyUrl) { - headers['Target-URL'] = url; - } - fetch(proxyUrl || url, { + fetch(url, { method: 'POST', - headers, + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${event.metadata.token}`, + user_agent_v2: event.metadata.userAgent, + }, body: JSON.stringify(requestBody), }) .then(response => { diff --git a/packages/hms-video-store/src/index.ts b/packages/hms-video-store/src/index.ts index 94027d2110..7e3783a783 100644 --- a/packages/hms-video-store/src/index.ts +++ b/packages/hms-video-store/src/index.ts @@ -53,7 +53,6 @@ export type { HMSQuizLeaderboardResponse, HMSQuizLeaderboardSummary, HMSTranscriptionInfo, - HMSProxyConfig, HMSICEServer, } from './internal'; diff --git a/packages/hms-video-store/src/interfaces/config.ts b/packages/hms-video-store/src/interfaces/config.ts index ba4f278813..6246882735 100644 --- a/packages/hms-video-store/src/interfaces/config.ts +++ b/packages/hms-video-store/src/interfaces/config.ts @@ -12,16 +12,6 @@ export type HMSICEServer = { password?: string; }; -enum HMSProxyType { - HTTPS = 0, -} - -export type HMSProxyConfig = { - type: HMSProxyType; - host: string; - port: number; -}; - export interface HMSConfig { /** * the name of the peer, can be later accessed via peer.name and can also be changed mid call. @@ -74,10 +64,6 @@ export interface HMSConfig { * will be kept awake. */ autoManageWakeLock?: boolean; - /** - * use custom proxy for signalling connection (advanced) - */ - proxy?: HMSProxyConfig; /** * use custom STUN/TURN servers for media connection (advanced) */ diff --git a/packages/hms-video-store/src/signal/init/index.ts b/packages/hms-video-store/src/signal/init/index.ts index 3f145b8797..26a5763781 100644 --- a/packages/hms-video-store/src/signal/init/index.ts +++ b/packages/hms-video-store/src/signal/init/index.ts @@ -1,8 +1,7 @@ import { InitConfig } from './models'; import { ErrorFactory } from '../../error/ErrorFactory'; import { HMSAction } from '../../error/HMSAction'; -import { HMSICEServer, HMSProxyConfig } from '../../interfaces'; -import { getEndpointFromProxy } from '../../utils/get-endpoint-from-proxy'; +import { HMSICEServer } from '../../interfaces'; import { transformIceServerConfig } from '../../utils/ice-server-config'; import HMSLogger from '../../utils/logger'; @@ -30,7 +29,6 @@ export default class InitService { initEndpoint = 'https://prod-init.100ms.live', region = '', iceServers = [], - proxy, }: { token: string; peerId: string; @@ -38,18 +36,12 @@ export default class InitService { initEndpoint?: string; region?: string; iceServers?: HMSICEServer[]; - proxy?: HMSProxyConfig; }): Promise { HMSLogger.d(TAG, `fetchInitConfig: initEndpoint=${initEndpoint} token=${token} peerId=${peerId} region=${region} `); const url = getUrl(initEndpoint, peerId, userAgent, region); try { - const proxyUrl = getEndpointFromProxy(proxy); - const headers: Record = { Authorization: `Bearer ${token}` }; - if (proxyUrl) { - headers['Target-URL'] = url; - } - const response = await fetch(proxyUrl || url, { - headers, + const response = await fetch(url, { + headers: { Authorization: `Bearer ${token}` }, }); try { const config = await response.clone().json(); diff --git a/packages/hms-video-store/src/transport/index.ts b/packages/hms-video-store/src/transport/index.ts index fb9fffe501..6d05a3491c 100644 --- a/packages/hms-video-store/src/transport/index.ts +++ b/packages/hms-video-store/src/transport/index.ts @@ -23,7 +23,7 @@ import { ErrorFactory } from '../error/ErrorFactory'; import { HMSAction } from '../error/HMSAction'; import { HMSException } from '../error/HMSException'; import { EventBus } from '../events/EventBus'; -import { HMSICEServer, HMSProxyConfig, HMSRole } from '../interfaces'; +import { HMSICEServer, HMSRole } from '../interfaces'; import { HMSLocalStream } from '../media/streams/HMSLocalStream'; import { HMSLocalTrack, HMSLocalVideoTrack, HMSTrack } from '../media/tracks'; import { TrackState } from '../notification-manager'; @@ -449,7 +449,6 @@ export default class HMSTransport { customData: { name: string; metaData: string }, autoSubscribeVideo = false, iceServers?: HMSICEServer[], - proxy?: HMSProxyConfig, ): Promise { this.setTransportStateForConnect(); this.joinParameters = new JoinParameters( @@ -460,10 +459,9 @@ export default class HMSTransport { endpoint, autoSubscribeVideo, iceServers, - proxy, ); try { - const response = await this.internalConnect(token, endpoint, peerId, iceServers, proxy); + const response = await this.internalConnect(token, endpoint, peerId, iceServers); return response; } catch (error) { const shouldRetry = @@ -479,7 +477,7 @@ export default class HMSTransport { if (shouldRetry) { const task = async () => { - await this.internalConnect(token, endpoint, peerId, iceServers, proxy); + await this.internalConnect(token, endpoint, peerId, iceServers); return Boolean(this.initConfig && this.initConfig.endpoint); }; @@ -903,13 +901,7 @@ export default class HMSTransport { } } - private async internalConnect( - token: string, - initEndpoint: string, - peerId: string, - iceServers?: HMSICEServer[], - proxy?: HMSProxyConfig, - ) { + private async internalConnect(token: string, initEndpoint: string, peerId: string, iceServers?: HMSICEServer[]) { HMSLogger.d(TAG, 'connect: started ⏰'); const connectRequestedAt = new Date(); try { @@ -920,7 +912,6 @@ export default class HMSTransport { userAgent: this.store.getUserAgent(), initEndpoint, iceServers, - proxy, }); const room = this.store.getRoom(); if (room) { @@ -930,7 +921,7 @@ export default class HMSTransport { room.isNoiseCancellationEnabled = this.isFlagEnabled(InitFlags.FLAG_NOISE_CANCELLATION); } this.analyticsTimer.end(TimedEvent.INIT); - HTTPAnalyticsTransport.setWebsocketEndpoint(this.initConfig.endpoint, proxy); + HTTPAnalyticsTransport.setWebsocketEndpoint(this.initConfig.endpoint); // if leave was called while init was going on, don't open websocket this.validateNotDisconnected('post init'); await this.openSignal(token, peerId); diff --git a/packages/hms-video-store/src/transport/models/JoinParameters.ts b/packages/hms-video-store/src/transport/models/JoinParameters.ts index 379ff33718..4e71d97146 100644 --- a/packages/hms-video-store/src/transport/models/JoinParameters.ts +++ b/packages/hms-video-store/src/transport/models/JoinParameters.ts @@ -1,4 +1,4 @@ -import { HMSICEServer, HMSProxyConfig } from '../../interfaces'; +import { HMSICEServer } from '../../interfaces'; export class JoinParameters { constructor( @@ -9,6 +9,5 @@ export class JoinParameters { public endpoint: string = 'https://prod-init.100ms.live/init', public autoSubscribeVideo: boolean = false, public iceServers?: HMSICEServer[], - public proxy?: HMSProxyConfig, ) {} } diff --git a/packages/hms-video-store/src/utils/get-endpoint-from-proxy.ts b/packages/hms-video-store/src/utils/get-endpoint-from-proxy.ts deleted file mode 100644 index c70e233be7..0000000000 --- a/packages/hms-video-store/src/utils/get-endpoint-from-proxy.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { HMSProxyConfig } from '../interfaces'; - -export const getEndpointFromProxy = (proxy?: HMSProxyConfig) => { - if (!proxy) { - return ''; - } - let endpoint = `://${proxy.host}:${proxy.port}`; - switch (proxy.type) { - case 0: - endpoint = `https${endpoint}`; - break; - default: - endpoint = `https${endpoint}`; - } - return endpoint; -}; diff --git a/packages/react-sdk/src/hooks/usePreviewJoin.ts b/packages/react-sdk/src/hooks/usePreviewJoin.ts index 2985651f79..8da681b360 100644 --- a/packages/react-sdk/src/hooks/usePreviewJoin.ts +++ b/packages/react-sdk/src/hooks/usePreviewJoin.ts @@ -3,7 +3,6 @@ import { HMSConfigInitialSettings, HMSICEServer, HMSPreviewConfig, - HMSProxyConfig, HMSRoomState, selectIsConnectedToRoom, selectRoomState, @@ -54,11 +53,6 @@ export interface usePreviewInput { */ autoManageWakeLock?: boolean; - /** - * use custom proxy for signalling connection (advanced) - */ - proxy?: HMSProxyConfig; - /** * use custom STUN/TURN servers for media connection (advanced) */ @@ -102,7 +96,6 @@ export const usePreviewJoin = ({ asRole, autoManageVideo, autoManageWakeLock, - proxy, iceServers, }: usePreviewInput): usePreviewResult => { const actions = useHMSActions(); @@ -122,7 +115,6 @@ export const usePreviewJoin = ({ captureNetworkQualityInPreview, autoManageVideo, autoManageWakeLock, - proxy, iceServers, }; }, [ @@ -135,7 +127,6 @@ export const usePreviewJoin = ({ asRole, autoManageVideo, autoManageWakeLock, - proxy, iceServers, ]);