Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How long does presence last on react native #165

Open
G2Jose opened this issue Sep 7, 2024 · 0 comments
Open

How long does presence last on react native #165

G2Jose opened this issue Sep 7, 2024 · 0 comments

Comments

@G2Jose
Copy link

G2Jose commented Sep 7, 2024

I couldn't find this documented anywhere, is there a TTL on presence?

On the docs it says:

Presence is an object that each peer shares with every other peer. When a user updates their presence, it's instantly replicated to all users in that room. Presence persists throughout the remainder of a user's connection, and is automatically cleaned up when a user leaves the room

To test, I have code running on an android emulator and a iOS simulator. I close the app on either device, and expect to see the updated presence reflected on the other device, but I don't. Could it be that it's delayed?

Here's my code:

function usePresence() {
  const userId = useAppSelector(getCurrentUserId)
  const appState = useAppState()
  const presence = room.usePresence()
  room.useSyncPresence({ id: userId, online: appState === 'active' })
  return presence
}
export const Room = memo(() => {
  const { presence } = usePresence()
  return <SomeView /> // this view tells me if the other device is still online
}

Things I've tried:

  1. Backgrounding either app does not clear presence
  2. Fully closing either app does not clear presence
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant