From c2ea930d47d34de1cef91fa74dad83727d808bf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6kay=20=C5=9Eim=C5=9Fek?= Date: Mon, 10 Nov 2025 14:35:01 +0300 Subject: [PATCH 1/3] feat: add support for custom TURN servers in AnamClient configuration --- src/AnamClient.ts | 12 ++++++++++-- src/types/AnamPublicClientOptions.ts | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/AnamClient.ts b/src/AnamClient.ts index 77d6e76..cbc8b48 100644 --- a/src/AnamClient.ts +++ b/src/AnamClient.ts @@ -200,14 +200,22 @@ export default class AnamClient { engineProtocol, signallingEndpoint, } = response; - const { heartbeatIntervalSeconds, maxWsReconnectionAttempts, iceServers } = - clientConfig; + const { + heartbeatIntervalSeconds, + maxWsReconnectionAttempts, + iceServers: defaultIceServers, + } = clientConfig; this.sessionId = sessionId; setMetricsContext({ sessionId: this.sessionId, }); + // Use custom TURN server if provided, otherwise use server-provided ICE servers + const iceServers = this.clientOptions?.customTurnServers + ? this.clientOptions.customTurnServers + : defaultIceServers; + try { this.streamingClient = new StreamingClient( sessionId, diff --git a/src/types/AnamPublicClientOptions.ts b/src/types/AnamPublicClientOptions.ts index 05a21d3..04ee8ae 100644 --- a/src/types/AnamPublicClientOptions.ts +++ b/src/types/AnamPublicClientOptions.ts @@ -10,4 +10,5 @@ export interface AnamPublicClientOptions { showPeerConnectionStatsReport?: boolean; peerConnectionStatsReportOutputFormat?: 'console' | 'json'; }; + customTurnServers?: RTCIceServer[]; } From b3caec88392498994e33c1cb6c323df332b4b875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6kay=20=C5=9Eim=C5=9Fek?= Date: Mon, 10 Nov 2025 14:56:48 +0300 Subject: [PATCH 2/3] refactor: rename customTurnServers to iceServers in AnamClient configuration --- src/AnamClient.ts | 4 ++-- src/types/AnamPublicClientOptions.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/AnamClient.ts b/src/AnamClient.ts index cbc8b48..6c2f251 100644 --- a/src/AnamClient.ts +++ b/src/AnamClient.ts @@ -212,8 +212,8 @@ export default class AnamClient { }); // Use custom TURN server if provided, otherwise use server-provided ICE servers - const iceServers = this.clientOptions?.customTurnServers - ? this.clientOptions.customTurnServers + const iceServers = this.clientOptions?.iceServers + ? this.clientOptions.iceServers : defaultIceServers; try { diff --git a/src/types/AnamPublicClientOptions.ts b/src/types/AnamPublicClientOptions.ts index 04ee8ae..e5cfc5f 100644 --- a/src/types/AnamPublicClientOptions.ts +++ b/src/types/AnamPublicClientOptions.ts @@ -10,5 +10,5 @@ export interface AnamPublicClientOptions { showPeerConnectionStatsReport?: boolean; peerConnectionStatsReportOutputFormat?: 'console' | 'json'; }; - customTurnServers?: RTCIceServer[]; + iceServers?: RTCIceServer[]; } From b32620b21db2b552809bf9d080254a2e965d56c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6kay=20=C5=9Eim=C5=9Fek?= Date: Mon, 10 Nov 2025 15:25:47 +0300 Subject: [PATCH 3/3] refactor: update comment to clarify usage of custom ICE servers in AnamClient --- src/AnamClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AnamClient.ts b/src/AnamClient.ts index 6c2f251..1baa06b 100644 --- a/src/AnamClient.ts +++ b/src/AnamClient.ts @@ -211,7 +211,7 @@ export default class AnamClient { sessionId: this.sessionId, }); - // Use custom TURN server if provided, otherwise use server-provided ICE servers + // Use custom ICE servers if provided, otherwise use server-provided ICE servers const iceServers = this.clientOptions?.iceServers ? this.clientOptions.iceServers : defaultIceServers;