Skip to content

Commit

Permalink
Reconnect on lost websocket connection
Browse files Browse the repository at this point in the history
When the websocket connection failed after having been established before,
the complete rtc session is tried to reinitialize.
  • Loading branch information
farao committed May 21, 2020
1 parent 474e28b commit 85d9f94
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/views/Room.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export default {
peers: [],
localPeer: null,
infoPage: null,
signalingConnectedBefore = false,
}
},
created() {
Expand Down Expand Up @@ -84,12 +85,22 @@ export default {
rtc.on("signaling_not_reachable", () => {
logger.error("signaling server not reachable")
this.uiState = [RoomError, { error: "connection_error" }]
if this.signalingConnectedBefore {
// TODO: show "Palava server not reachable" or "Network not reachable" overlay
rtc.reconnect()
} else {
this.uiState = [RoomError, { error: "connection_error" }]
}
})
rtc.on("signaling_error", (error) => {
logger.error("signaling error", error)
this.uiState = [RoomError, { error: "connection_error" }]
if this.signalingConnectedBefore {
// TODO: show "Palava server not reachable" or "Network not reachable" overlay
rtc.reconnect()
} else {
this.uiState = [RoomError, { error: "connection_error" }]
}
})
rtc.on("signaling_shutdown", (seconds) => {
Expand Down

0 comments on commit 85d9f94

Please sign in to comment.