Skip to content

Commit 48fa7a7

Browse files
committed
fix: update to tokenSource name in Room class
1 parent 8183d15 commit 48fa7a7

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/room/Room.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
171171
/** future holding client initiated connection attempt */
172172
private connectFuture?: Future<void>;
173173

174-
private connectionCredentials?: TokenSource;
174+
private tokenSource?: TokenSource;
175175

176176
private disconnectLock: Mutex;
177177

@@ -591,7 +591,7 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
591591
* With LiveKit Cloud, it will also determine the best edge data center for
592592
* the current client to connect to if a token is provided.
593593
*/
594-
prepareConnection(connectionCredentials: TokenSource): Promise<void>;
594+
prepareConnection(tokenSource: TokenSource): Promise<void>;
595595
prepareConnection(url: string): Promise<void>;
596596
/** @deprecated Use room.prepareConnection(new TokenSource.Literal({ server_url: "url", participant_token: "token" })) instead */
597597
prepareConnection(url: string, token?: string): Promise<void>;
@@ -612,7 +612,7 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
612612
token = tokenOrUnknown;
613613
} else {
614614
throw new Error(
615-
`Room.prepareConnection received invalid parameters - expected url, url/token or connectionCredentials, received ${urlOrTokenSource}, ${tokenOrUnknown}`,
615+
`Room.prepareConnection received invalid parameters - expected url, url/token or tokenSource, received ${urlOrTokenSource}, ${tokenOrUnknown}`,
616616
);
617617
}
618618

@@ -640,28 +640,28 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
640640
}
641641

642642
connect: {
643-
(connectionCredentials: TokenSource, opts?: RoomConnectOptions): Promise<void>;
643+
(tokenSource: TokenSource, opts?: RoomConnectOptions): Promise<void>;
644644
/** @deprecated Use room.connect(new TokenSource.Literal({ server_url: "url", participant_token: "token" }), opts?: RoomConnectOptions) instead */
645645
(url: string, token: string, opts?: RoomConnectOptions): Promise<void>;
646646
} = async (urlOrTokenSource, tokenOrOpts, optsOrUnset?: unknown): Promise<void> => {
647647
let opts: RoomConnectOptions = {};
648648
if (urlOrTokenSource instanceof TokenSource && typeof tokenOrOpts !== 'string') {
649-
this.connectionCredentials = urlOrTokenSource;
649+
this.tokenSource = urlOrTokenSource;
650650
opts = tokenOrOpts ?? {};
651651
} else if (typeof urlOrTokenSource === 'string' && typeof tokenOrOpts === 'string') {
652-
this.connectionCredentials = new TokenSource.Literal({
652+
this.tokenSource = new TokenSource.Literal({
653653
server_url: urlOrTokenSource,
654654
participant_token: tokenOrOpts,
655655
});
656656
opts = optsOrUnset ?? {};
657657
} else {
658658
throw new Error(
659-
`Room.connect received invalid parameters - expected url/token or connectionCredentials, received ${urlOrTokenSource}, ${tokenOrOpts}, ${optsOrUnset}`,
659+
`Room.connect received invalid parameters - expected url/token or tokenSource, received ${urlOrTokenSource}, ${tokenOrOpts}, ${optsOrUnset}`,
660660
);
661661
}
662662

663663
const { server_url: url, participant_token: token } =
664-
await this.connectionCredentials.generate();
664+
await this.tokenSource.generate();
665665

666666
if (!isBrowserSupported()) {
667667
if (isReactNative()) {
@@ -1008,7 +1008,7 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
10081008
this.handleDisconnect(stopTracks, DisconnectReason.CLIENT_INITIATED);
10091009
/* @ts-ignore */
10101010
this.engine = undefined;
1011-
this.connectionCredentials?.generate();
1011+
this.tokenSource?.generate();
10121012
} finally {
10131013
unlock();
10141014
}

0 commit comments

Comments
 (0)