diff --git a/frontend/app/lib/client-socket-provider.tsx b/frontend/app/lib/client-socket-provider.tsx index ef99b58e..2849d333 100644 --- a/frontend/app/lib/client-socket-provider.tsx +++ b/frontend/app/lib/client-socket-provider.tsx @@ -143,8 +143,10 @@ export default function SocketProvider() { showNotificationToast(data); } }; - chatSocket.onAny(handler); - chatSocket.connect(); + if (currentUser) { + chatSocket.onAny(handler); + chatSocket.connect(); + } return () => { chatSocket.offAny(handler); chatSocket.disconnect();