Online/offline status in Tinode's webapp

45 views
Skip to first unread message

radazul...@gmail.com

unread,
Jul 29, 2020, 12:00:44 PM7/29/20
to Tinode General
Have somebody fixed the issue with online/offline status in the Webapp and could share the code?

Right now user always stays "online", even with minimized browser when using another program and with screen off on mobile phones. User only should appear online when browser tab with Tinode's chat is visible.
To the sender it looks that recipient is online but ignoring received messages.

As I see, the web app already is using "visibilitychange", so it could be easy to fix it but I am not familiar with React.

Gene

unread,
Jul 29, 2020, 12:29:10 PM7/29/20
to Tinode General
I agree in general. The key is how to fix it. 

I see two ways:

1. Disconnect from the server when the tab is in background. It's a very simple fix and it will work with minimal client-side changes in just the webapp.
2. Allow clients to send an 'away' note. This will require  changes to all clients and the server but is potentially nicer with respect t user experience.

I'm OK with doing just the 1 for now. If you would like to send a pull request, please do so. This change is not React-specific. Thanks.

Reply all
Reply to author
Forward
0 new messages