diff --git a/widget/src/providers/ChatProvider.tsx b/widget/src/providers/ChatProvider.tsx index 0bd20df8..f907c428 100644 --- a/widget/src/providers/ChatProvider.tsx +++ b/widget/src/providers/ChatProvider.tsx @@ -453,8 +453,10 @@ const ChatProvider: React.FC<{ handleSubscription, }; - useBroadcastChannel("session", () => { - socketCtx.socket.disconnect(); + useBroadcastChannel("session", (e) => { + if (e.data === "logout") { + socketCtx.socket.disconnect(); + } }); return (