diff --git a/app/main/ipc/client.js b/app/main/ipc/client.js index b815253e..aa08546d 100644 --- a/app/main/ipc/client.js +++ b/app/main/ipc/client.js @@ -45,6 +45,7 @@ class Socket extends EventEmitter { this.dieTimeout = clearTimeout(this.dieTimeout) this.hearbeat = setInterval(()=>{ + if (!this.connected()) return this.socket.send(`["ping"]`) this.hearbeatTimeout = setTimeout(()=>{ if (this.connected()) this.socket.close() @@ -57,6 +58,7 @@ class Socket extends EventEmitter { this.hearbeat = clearInterval(this.hearbeat) this.hearbeatTimeout = clearTimeout(this.hearbeatTimeout) + this.dieTimeout = clearTimeout(this.dieTimeout) this.dieTimeout = setTimeout(()=>{ diff --git a/src/browser/js/app/ipc/index.js b/src/browser/js/app/ipc/index.js index 26b3721f..956d18eb 100644 --- a/src/browser/js/app/ipc/index.js +++ b/src/browser/js/app/ipc/index.js @@ -52,6 +52,7 @@ class Ipc extends EventEmitter { this.reconnect = clearInterval(this.reconnect) this.hearbeat = setInterval(()=>{ + if (!this.connected()) return this.socket.send(`["ping"]`) this.hearbeatTimeout = setTimeout(()=>{ if (this.connected()) this.socket.close() @@ -79,6 +80,7 @@ class Ipc extends EventEmitter { this.hearbeat = clearInterval(this.hearbeat) this.hearbeatTimeout = clearTimeout(this.hearbeatTimeout) + this.dieTimeout = clearTimeout(this.dieTimeout) if (!this.reconnect) { this.reconnect = setInterval(()=>{