resend topic on ws reconect

main
alex 2023-10-23 16:56:44 +02:00
parent 076ed7f6e7
commit b6824989c2
1 changed files with 15 additions and 4 deletions

View File

@ -22,6 +22,7 @@ import {
hasOnePermission, hasOnePermission,
hasOneXYPermission, hasOneXYPermission,
hasPermission, hasPermission,
wsConnectionCustomEventName,
} from "../../utils"; } from "../../utils";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { MyUserAvatar } from "../MyAvatar"; import { MyUserAvatar } from "../MyAvatar";
@ -296,10 +297,20 @@ export function SideMenuContent({
lastSubscribedTopic.current = pathname; lastSubscribedTopic.current = pathname;
webSocketContext.SendSocketMessage(SentMessagesCommands.SubscribeToTopic, { const subscribeTopicMessage = () =>
topic: pathname, webSocketContext.SendSocketMessage(
browserTabSession: BrowserTabSession, SentMessagesCommands.SubscribeToTopic,
}); {
topic: pathname,
browserTabSession: BrowserTabSession,
}
);
subscribeTopicMessage();
document.addEventListener(wsConnectionCustomEventName, () =>
subscribeTopicMessage()
);
// auto close sideMenu on mobile // auto close sideMenu on mobile
// this will prevent to auto close sideMenu on first render as the useEffects will be called after the first render // this will prevent to auto close sideMenu on first render as the useEffects will be called after the first render