Skip to content

Commit 921eac6

Browse files
fix: signalr not connecting on logout and re-login (ShokoAnime#867)
1 parent 4d0412d commit 921eac6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/core/middlewares/signalr.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
HttpTransportType,
33
type HubConnection,
44
HubConnectionBuilder,
5+
HubConnectionState,
56
JsonHubProtocol,
67
LogLevel,
78
} from '@microsoft/signalr';
@@ -106,7 +107,9 @@ next =>
106107
async (action: UnknownAction) => {
107108
// register signalR after the user logged in
108109
if (action.type === Events.MAINPAGE_LOADED) {
109-
if (connectionEvents !== undefined) return next(action);
110+
if (connectionEvents !== undefined && connectionEvents.state !== HubConnectionState.Disconnected) {
111+
return next(action);
112+
}
110113
const connectionHub = '/signalr/aggregate?feeds=anidb,shoko,queue,network,avdump';
111114

112115
const protocol = new JsonHubProtocol();

0 commit comments

Comments
 (0)