webapp icon indicating copy to clipboard operation
webapp copied to clipboard

Change status from [online] to [away] or [offline] when the user is inactive or the tab is in the background

Open sanmiguel2019 opened this issue 5 years ago • 3 comments

When user closes the browser or switches to another browser tab, the status does not change to "offline" and is still visible as "online" for some 10 minutes. "Online" status only should be shown when browser tab with Tinode is opened and device's screen is not off.

sanmiguel2019 avatar May 16 '20 15:05 sanmiguel2019

When user closes the browser

You mean minimizes the browser? When browser is closed the user goes offline in 5 seconds.

or-else avatar May 16 '20 17:05 or-else

User: alice using desktop computer, Chrome browser

is chatting with

User: dave using mobile telephone, Firefow browser.

User "dave" closes the browser and turns telehone's screen off. More or less 3 minutes "dave" is still online. Dave turns telephone's screen on and immediately appears online even without accessing the browser.

User "alise" is always online. "Alise" has opened multiple tabs in the browser. Even when not using "Tinode's" tab for a long time, she is always online. User "alise" minimizes the browser and starts using another program. She is always online. Only when she closes completely "Tinode's" tab, the status after 5 seconds changes to "offline".

Look at web.whatsapp.com. Whatsapp's web version is opened all the day in my computer but it does not mean that I am always "online". I appear "online" only when the tab with Whatsapp is visible on my screen. As soon as I switch between browser tabs or start using another program (without closing the browser), I am "offline".

I think there should be used some page visibility api to detect correctly when user is using Tinode and when is not. For example:

https://github.com/pgilad/react-page-visibility

sanmiguel2019 avatar May 18 '20 14:05 sanmiguel2019

You are welcome to send a pull request.

or-else avatar May 18 '20 16:05 or-else