mirror of
https://github.com/oxen-io/oxen-electron-gui-wallet.git
synced 2023-12-14 06:13:02 +01:00
delay on client side web socket listening to prevent hanging on connecting to backend step
This commit is contained in:
parent
04b70b3a48
commit
885751dd2c
|
@ -106,9 +106,9 @@ function createWindow() {
|
|||
|
||||
portscanner.checkPortStatus(config.port, "127.0.0.1", (error, status) => {
|
||||
if (status == "closed") {
|
||||
mainWindow.webContents.send("initialize", config)
|
||||
backend = new Backend(mainWindow)
|
||||
backend.init(config)
|
||||
mainWindow.webContents.send("initialize", config)
|
||||
} else {
|
||||
dialog.showMessageBox(mainWindow, {
|
||||
title: "Startup error",
|
||||
|
|
|
@ -34,9 +34,11 @@ export class Gateway {
|
|||
|
||||
ipcRenderer.on("initialize", (event, data) => {
|
||||
this.token = data.token
|
||||
this.ws = new WebSocket("ws://127.0.0.1:"+data.port);
|
||||
this.ws.on("open", () => {this.open()});
|
||||
this.ws.on("message", (message) => {this.receive(message)});
|
||||
setTimeout(() => {
|
||||
this.ws = new WebSocket("ws://127.0.0.1:"+data.port);
|
||||
this.ws.on("open", () => {this.open()});
|
||||
this.ws.on("message", (message) => {this.receive(message)});
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
ipcRenderer.on("confirmClose", () => {
|
||||
|
|
Loading…
Reference in a new issue