I am using v4 JS SDK with React Native.
{
"@sendbird/chat": "^4.0.3",
"react-native": "0.68.2"
}
I am getting the following error while trying to call sb.disconnect()
[TypeError: window.removeEventListener is not a function. (In 'window.removeEventListener("visibilitychange", this._toggleState.bind(this), {
capture: !0
})', 'window.removeEventListener' is undefined)]
my code snippet
const disconnectSendbird = useCallback(() => {
if (sendbirdChannelRef.current) {
console.log('sendbird:ChannelDisconnecting');
sendbirdChannelRef.current
.exit()
.then(() => {
console.log('sendbird:sendbirdChannelRefDisconnected');
sendbirdChannelRef.current = null;
if (sendbirdRef.current) {
console.log('sendbird:Disconnecting');
sendbirdRef.current
.disconnect()
.then(() => {
console.log('sendbird:sendbirdRefDisconnected');
sendbirdRef.current = null;
})
.catch(error => {
console.log('sendbird:sendbirdDisconnectError', error);
});
}
})
.catch(error => {
console.log('sendbird:sendbirdChannelExitError', error);
});
}
}, []);
The WebSocket connection to sendbird is not closing, please help me with this error.