cfdp / opeka

Counseling chat service, built for providing anonymous help to young people at risk
https://curachat.com
GNU General Public License v3.0
10 stars 6 forks source link

Disconnected user remains in room #108

Open cfdp opened 7 years ago

cfdp commented 7 years ago

Scenario: Creating a group chat room as counselor.

Connecting as an anonymous client via another device and IP and loosing internet connection for a period of time that exceeds the reconnect time window (i.e. client gets the "Connection to the server was lost"-popup).

In the group chat room the anonymous client is still displayed as connected.

Expected behavior: When a user looses connection the user should be removed from any chat rooms as well.

This error relates to #94 @alex-bukach

alex-bukach commented 7 years ago

@benjamin-dk actually it's expected behavior for now in sense that it had not been introduced by https://github.com/cfdp/opeka/issues/94. I mentioned about this issue though in my comment https://github.com/cfdp/opeka/issues/94#issuecomment-315329427, but I did not fix it within #94.

Looks like #105 is caused by an attempt to finish the session for a non-responding user after about 10 minutes, and this attempt fails. So one #105 is fixed, the user will be excluded from the chat after about 10 min after connection loss.

To clarify, we cannot know when a user loses a connection since the browser is not able to let us know about it (obviously, since the connection is lost). So the only thing we can do is to finish user session after a given time we don't get responses from user's browser. Are 10 min too much for that? How much should it be?

benjamin-dk commented 7 years ago

@alex-bukach I guess 10 minutes is a fine time interval.

To mitigate the issue of a disconnected /reconnecting client still being shown in the room, it is crucial to inform the other users in the room about this. Otherwise they might be writing this user and being frustrated that they get no answer.

E.g. we could add (reconnecting...) after the user name in the user list.

It should be possible to check if a client is connected like this

https://stackoverflow.com/questions/6563885/socket-io-how-do-i-get-a-list-of-connected-sockets-clients

benjamin-dk commented 7 years ago

@alex-bukach I can confirm that the issue of the disconnected user not being deleted from the room was not introduced with #94 see #115.