IO-1551 Polling mode for unsupported browsers.
This commit is contained in:
@@ -46,11 +46,8 @@ export function ChatAffixContainer({ bodyshop, chatVisible }) {
|
||||
<Space>
|
||||
<Button
|
||||
onClick={async () => {
|
||||
const resp = await requestForToken();
|
||||
console.log(
|
||||
"🚀 ~ file: chat-affix.container.jsx ~ line 44 ~ resp",
|
||||
resp
|
||||
);
|
||||
await requestForToken();
|
||||
|
||||
SubscribeToTopic();
|
||||
}}
|
||||
>
|
||||
@@ -84,12 +81,17 @@ export function ChatAffixContainer({ bodyshop, chatVisible }) {
|
||||
payload: (payload && payload.data && payload.data.data) || payload.data,
|
||||
});
|
||||
}
|
||||
const stopMessageListenr = onMessage(messaging, handleMessage);
|
||||
const channel = new BroadcastChannel("imex-sw-messages");
|
||||
channel.addEventListener("message", handleMessage);
|
||||
let stopMessageListenr, channel;
|
||||
try {
|
||||
stopMessageListenr = onMessage(messaging, handleMessage);
|
||||
channel = new BroadcastChannel("imex-sw-messages");
|
||||
channel.addEventListener("message", handleMessage);
|
||||
} catch (error) {
|
||||
console.log("Unable to set event listeners.");
|
||||
}
|
||||
return () => {
|
||||
stopMessageListenr();
|
||||
channel.removeEventListener("message", handleMessage);
|
||||
stopMessageListenr && stopMessageListenr();
|
||||
channel && channel.removeEventListener("message", handleMessage);
|
||||
};
|
||||
}, [client]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user