User presence is not updating the server when leaving due to user or browser inactivity

When in the same screen we enter only channels that all have the default onlyWhenActive (which is by default true when calling channel.enter()) → the wrong call is made to the server when going idle to update this channels

How to reproduce

  • First disable the chat plugin if you have it enabled (this is important because chat plugins makes a call in all screens to .enter({onlyWhenActive: false} with the onlyWhenActive option set to false

  • Add a channel for the sake of the demo. I choose topic-presence-display.js and I added this:

  @on("init")
  _init() {
    this._presentChannel = this.presence.getChannel('/presence-idle-demo');
    this._presentChannel.enter();
  },
  • Open any topic with the browser network console opened → you should see a first call to /presence/update

  • Minimize the browser window (with the network tab opened) and wait a little bit more than 10 seconds ( this is the browser inactivity time by default)

  • Open the browser again and look at the latest call made to /presence/update

Current result:

image

While it should be leave_channels[]: /presence-idle-demo

I opened a pull request:

6 Likes

Kudos for the careful debugging here and finding the root cause … we will review this week and see if we can merge the fix!

6 Likes

@david pushed this over the finish line and it’s now merged :tada:

Thanks @AhmedLoud for raising this and submitting a PR :clap:

7 Likes