Action on realtime disconnect or after a set period of time. #730
-
Hello, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
👋 just trying to guess the intent of you question: Are you trying to determine when somebody is "online" (for things like chat apps)? If so, this is called "Presence". It's something we will offer in the future, but haven't built yet To answer your question more specifically - this should be possible to do like this: const mySubscription = supabase
.from('*')
.on('*', (payload) => {
console.log('Change received!', payload)
})
.subscribe()
mySubscription.onClose(() => {
// Do something
}) The reason why this isn't a great idea for "Presence" use-cases is because there could be a failure to "delete the row on disconnect". Ideally you want the server to detect "is connected", and then if a client isn't connected after XX seconds it will mark the client as "disconnected" |
Beta Was this translation helpful? Give feedback.
👋 just trying to guess the intent of you question: Are you trying to determine when somebody is "online" (for things like chat apps)?
If so, this is called "Presence". It's something we will offer in the future, but haven't built yet
To answer your question more specifically - this should be possible to do like this:
The reason why this isn't a great idea for "Presence" use-cases is because there could be a failure to "delete the row on disconnect". Ideally you want the server …