Skip to content

Commit

Permalink
check websocket connection
Browse files Browse the repository at this point in the history
  • Loading branch information
yann300 authored and LianaHus committed Jul 8, 2020
1 parent e894b92 commit 8999079
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/app/files/remixd-handle.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ export class RemixdHandle extends WebsocketPlugin {
)
this.canceled()
} else {
const intervalId = setInterval(() => {
if (!this.socket || (this.socket && this.socket.readyState === 3)) { // 3 means connection closed
clearInterval(intervalId)
console.log(error)
modalDialogCustom.alert(
'Connection to remixd terminated' +
'Please make sure remixd is still running in the background.'
)
this.canceled()
}
}, 3000)
this.locahostProvider.init(_ => this.fileSystemExplorer.ensureRoot())
}
}
Expand All @@ -85,7 +96,7 @@ export class RemixdHandle extends WebsocketPlugin {
try {
super.activate()
setTimeout(() => {
if (!this.socket) {
if (!this.socket || (this.socket && this.socket.readyState === 3)) { // 3 means connection closed
connection(new Error('Connection with daemon failed.'))
} else {
connection()
Expand Down

0 comments on commit 8999079

Please sign in to comment.