Skip to content

Commit

Permalink
Clean webrtc.js
Browse files Browse the repository at this point in the history
  • Loading branch information
sergystepanov committed Apr 22, 2024
1 parent dceb6f9 commit a013192
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions web/js/network/webrtc.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,27 +98,24 @@ const ice = (() => {
onIceConnectionStateChange: () => {
log.info('[rtc] <- iceConnectionState', connection.iceConnectionState);
switch (connection.iceConnectionState) {
case 'connected': {
case 'connected':
log.info('[rtc] connected...');
connected = true;
break;
}
case 'disconnected': {
case 'disconnected':
log.info(`[rtc] disconnected... ` +
`connection: ${connection.connectionState}, ice: ${connection.iceConnectionState}, ` +
`gathering: ${connection.iceGatheringState}, signalling: ${connection.signalingState}`)
connected = false;
pub(WEBRTC_CONNECTION_CLOSED);
break;
}
case 'failed': {
case 'failed':
log.error('[rtc] failed establish connection, retry...');
connected = false;
connection.createOffer({iceRestart: true})
.then(description => connection.setLocalDescription(description).catch(log.error))
.catch(log.error);
break;
}
}
}
}
Expand Down

0 comments on commit a013192

Please sign in to comment.