yangjie #33
10
main.js
10
main.js
|
|
@ -720,7 +720,6 @@ const startSignalr = async (user) => {
|
||||||
})
|
})
|
||||||
.withAutomaticReconnect([0, 3000, 3000, 3000])
|
.withAutomaticReconnect([0, 3000, 3000, 3000])
|
||||||
.build();
|
.build();
|
||||||
connection.start();
|
|
||||||
mainWindow.webContents.send('changeLocalStorage', {
|
mainWindow.webContents.send('changeLocalStorage', {
|
||||||
isSignalr: true,
|
isSignalr: true,
|
||||||
reconnect: true,
|
reconnect: true,
|
||||||
|
|
@ -736,12 +735,19 @@ const startSignalr = async (user) => {
|
||||||
reconnect: false,
|
reconnect: false,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
connection.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
const onStart = async () => {
|
const onStart = async () => {
|
||||||
if (connection) {
|
if (connection) {
|
||||||
if (connection.state === signalR.HubConnectionState.Disconnected) {
|
if (connection.state === signalR.HubConnectionState.Disconnected) {
|
||||||
connection.start();
|
connection.start().then(() => {
|
||||||
|
mainWindow.webContents.send('changeLocalStorage', {
|
||||||
|
reconnect: true,
|
||||||
|
});
|
||||||
|
}).catch((err) => {
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (connection.state !== signalR.HubConnectionState.Connected) {
|
if (connection.state !== signalR.HubConnectionState.Connected) {
|
||||||
setTimeout(onStart, 3000);
|
setTimeout(onStart, 3000);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue