-
I want to use realtime to track the location of drivers in my app in realtime. The issue I'm having is that whenever I update the presence of a driver, it causes a leave event at the same time right after the join event. I tested this with 2 different drivers, one with swift and the other with kotlin library. I'd like to see both drivers in the currentPresences array at the same time so that the fleet of drivers can be visualized on a map in realtime. Any ideas if its expected that updating presence causes a leave event every time? Thank you for your help This question is similar to this one: https://github.com/orgs/supabase/discussions/13971 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I figured out that whenever the presence is updated, a leave event and a join event happen at the same time. This is expected behavior even though it is a bit confusing. You should process the leave events first and then the join events so that your presence cache is accurate after an update. There was a bug in the kotlin library where join events were processed first which caused presence to always be empty for updates. I submitted a PR to fix, but make sure this is happening in whatever client you use realtime in. PR to fix: supabase-community/supabase-kt#607 |
Beta Was this translation helpful? Give feedback.
I figured out that whenever the presence is updated, a leave event and a join event happen at the same time. This is expected behavior even though it is a bit confusing. You should process the leave events first and then the join events so that your presence cache is accurate after an update. There was a bug in the kotlin library where join events were processed first which caused presence to always be empty for updates. I submitted a PR to fix, but make sure this is happening in whatever client you use realtime in. PR to fix: supabase-community/supabase-kt#607