Skip to content

Commit eb22ad0

Browse files
feat: add support for custom TURN servers in AnamClient configuration (#166)
Co-authored-by: Gökay Şimşek <[email protected]>
1 parent e7c6c82 commit eb22ad0

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/AnamClient.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,22 @@ export default class AnamClient {
200200
engineProtocol,
201201
signallingEndpoint,
202202
} = response;
203-
const { heartbeatIntervalSeconds, maxWsReconnectionAttempts, iceServers } =
204-
clientConfig;
203+
const {
204+
heartbeatIntervalSeconds,
205+
maxWsReconnectionAttempts,
206+
iceServers: defaultIceServers,
207+
} = clientConfig;
205208

206209
this.sessionId = sessionId;
207210
setMetricsContext({
208211
sessionId: this.sessionId,
209212
});
210213

214+
// Use custom ICE servers if provided, otherwise use server-provided ICE servers
215+
const iceServers = this.clientOptions?.iceServers
216+
? this.clientOptions.iceServers
217+
: defaultIceServers;
218+
211219
try {
212220
this.streamingClient = new StreamingClient(
213221
sessionId,

src/types/AnamPublicClientOptions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ export interface AnamPublicClientOptions {
1010
showPeerConnectionStatsReport?: boolean;
1111
peerConnectionStatsReportOutputFormat?: 'console' | 'json';
1212
};
13+
iceServers?: RTCIceServer[];
1314
}

0 commit comments

Comments
 (0)