How Can I Stop Channels Users Going Offline For An Instant When They Navigate Between Pages?
Presence Channels are a simple way to be notified when a channel member comes online or goes offline. However, sometimes the user might refresh the page or navigate to a new part of your app - in these flows it doesn't necessary make sense to immediately mark the user offline and then put them back as online a moment later.
To overcome this, when a user leaves the room you could start a timeout to remove the user. If the user then rejoins the room within the timeout period you could clear that timeout to prevent marking the user as offline.
Code below for example purposes only:
Still have questions? Please reach out to our Support team by visiting this page.
PreviousHow Can I Add A Cluster Failover Process to My Channels Integration?NextHow Can I Transition A Live App To A Different Cluster?
Last updated