Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
pc1.onconnectionstatechange = (event: Event) => {
logger.verbose(`${LOG_PREFIX} ${chalk.yellow("connection-state")}: ${chalk.yellowBright(pc1.connectionState.toString())}`);
if (pc1.connectionState === RTCPeerConnectionState.Failed) {
for (const [, ch] of Object.entries(this.channels)) {
if (ch.pc === pc1) {
this.channelClose(ch);
}
}
}
};