Skip to content

Commit

Permalink
Add a timeout of 1s on repeatet reconnects
Browse files Browse the repository at this point in the history
  • Loading branch information
farao committed May 24, 2020
1 parent 78f5208 commit f938ee3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/views/Room.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export default {
localPeer: null,
infoPage: null,
signalingConnectedBefore: false,
repeatetReconnect: false,
}
},
created() {
Expand Down Expand Up @@ -126,6 +127,7 @@ export default {
const peers = this.rtc.room.getAllPeers()
this.signalingConnectedBefore = true
this.repeatetReconnect = false
if (peers.length > config.maximumPeers) {
this.uiState = [RoomError, { error: "room_full" }]
Expand Down Expand Up @@ -215,7 +217,12 @@ export default {
}
},
onlineEventListener() {
this.rtc.reconnect()
if (this.repeatetReconnect) {
setTimeout(this.rtc.reconnect, 1000)
} else {
this.repeatetReconnect = true
this.rtc.reconnect()
}
window.removeEventListener('online', this.onlineEventListener)
},
closeInfoScreen() {
Expand Down

0 comments on commit f938ee3

Please sign in to comment.