add different origin condition

This commit is contained in:
2024-10-31 13:30:41 +02:00
parent 8b14717b53
commit 96636bd0e3
4 changed files with 13 additions and 2 deletions

View File

@@ -893,6 +893,9 @@ export const Group = ({
useEffect(() => {
// Handler function for incoming messages
const messageHandler = (event) => {
if (event.origin !== window.location.origin) {
return;
}
const message = event.data;
if (message?.action === "SET_GROUPS") {

View File

@@ -107,7 +107,9 @@ export const WebSocketActive = ({ myAddress, setIsLoadingGroups }) => {
}
};
initWebsocketMessageGroup(); // Initialize WebSocket on component mount
initWebsocketMessageGroup(); // Initialize WebSocket on component mount
return () => {
forceCloseWebSocket(); // Clean up WebSocket on component unmount