I am building a React/Nextjs app that uses the SendbirdProvider component to initialize the Chat UI. Using uikit-react@3.15.3
. I have configured Sendbird webhook events to fire to my backend api for group_channel:message_send
events so that I can detect when logged out users receive new messages. The problem is that when a user logs out of my app there is a time period where the webhook events still show that user as being logged.
In an attempt to fix this, I’ve added a hook in my app that is called when a user signs out of my app and it uses the getDisconnect
selector like so:
import { getDisconnect } from '@sendbird/uikit-react/sendbirdSelectors'
import useSendbirdStateContext from '@sendbird/uikit-react/useSendbirdStateContext'
import { useCallback } from 'react'
import useAuth from './useAuth'
export const useSignoutOfEverything = () => {
const { signOut } = useAuth()
const sendbird = useSendbirdStateContext()
return useCallback(() => {
getDisconnect(sendbird)().then(() => signOut())
}, [signOut, sendbird])
}
I thought this would explicitly disconnect the user from sendbird as they log out of my app, but I still get webhook events for group_channel:message_send
which show is_online: true
for the user for some period of time. I don’t get any console errors on the call for getDisconnect(...)()
even when I have added extra logging and catches, so it appears that call is going through as expected.
Can anyone explain what is going on here? At a minimum, I’d like to know how long the timeout is before a user is reported as being is_online: false
in webhook events. Thanks for your help.