This commit is contained in:
yj 2024-11-01 11:21:54 +08:00
parent 55c3e0a22b
commit 380222bcfd
1 changed files with 8 additions and 2 deletions

10
main.js
View File

@ -720,7 +720,6 @@ const startSignalr = async (user) => {
})
.withAutomaticReconnect([0, 3000, 3000, 3000])
.build();
connection.start();
mainWindow.webContents.send('changeLocalStorage', {
isSignalr: true,
reconnect: true,
@ -736,12 +735,19 @@ const startSignalr = async (user) => {
reconnect: false,
});
});
connection.start();
}
const onStart = async () => {
if (connection) {
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) {
setTimeout(onStart, 3000);