Open sanmiguel2019 opened 4 years ago
When user closes the browser
You mean minimizes the browser? When browser is closed the user goes offline in 5 seconds.
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:
You are welcome to send a pull request.
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.