Handle presence leaves / joins on page navigate

I was fiddling around with Presence, and I noticed that presence sends leaves and joins when a user navigates trough the site. Its just a plain phoenix site, no react stuff etc.
The websocket connection is obviously reconnecting when a user navigates, because the page is reloaded.

I was wondering how to tackle this behaviour, maybe go with turbolinks or something. Or set a delay in the join in the channel?

Are the leaves and joins problematic with your features? The behavior is expected, but if you are wanting something like not seeing “flapping” users coming and going on the UI, I would handle it all client side with a timeout. So when you see a user leave from all devices/tabs, I would setTimeout a function to actually handle the UI update, which I would cancel from the join callback for that user if we see them return.

1 Like

thanks :slight_smile:
it’s not problematic, if noticed it and thought maybe its getting expensive when I run a lot of users …