in src/SignalingClient.ts [126:146]
private async asyncOpen(): Promise<void> {
const queryParams: QueryParams = {
'X-Amz-ChannelARN': this.config.channelARN,
};
if (this.config.role === Role.VIEWER) {
queryParams['X-Amz-ClientId'] = this.config.clientId;
}
const signedURL = await this.requestSigner.getSignedURL(this.config.channelEndpoint, queryParams, this.dateProvider.getDate());
// If something caused the state to change from CONNECTING, then don't create the WebSocket instance.
if (this.readyState !== ReadyState.CONNECTING) {
return;
}
this.websocket = new WebSocket(signedURL);
this.websocket.addEventListener('open', this.onOpen);
this.websocket.addEventListener('message', this.onMessage);
this.websocket.addEventListener('error', this.onError);
this.websocket.addEventListener('close', this.onClose);
}