How can I stop Channels users going offline for an instant when they navigate between pages?

When a user leaves the room you could start a timeout to remove the user. If the user then rejoins the room you could clear that timeout so the removal never actually occurs.

Code below for example purposes only:

function removeMember(member) {
    pendingRemoves[ ] = setTimeout(function() {
    }, 3000); // wait 3 seconds

function addMember(member) {
  var pendingRemoveTimeout = pendingRemoves[];
  if(pendingRemoveTimeout) {
    // user left, but has rejoined
Was this article helpful?
0 out of 0 found this helpful
Haven't found what you were looking for?
Submit a ticket