Hi
We develop a mobile application that allows user to login only from a single device at once, hence if we detect during the login process that the user is already logged, we kick the existing user and connect the new one.
I noticed that when my client switches to Wifi or 4G and vice versa, I fall into the case of duplicate login, which means that the server didn't close the previous socket (client didn't send FIN), so he consider the new message as new client.
Please correct me if I'm wrong, and let me know what is the best practice to handle such migration (Wifi/4G) without user awareness.
Thanks,
Rafael
How to handle duplicate login
-
- Posts: 25
- Joined: 28 Jun 2020, 08:54
Re: How to handle duplicate login
Hi,
we wrote an article on this subject in our blog:
https://smartfoxserver.com/blog/handlin ... e-devices/
Hope it helps
we wrote an article on this subject in our blog:
https://smartfoxserver.com/blog/handlin ... e-devices/
Hope it helps
-
- Posts: 25
- Joined: 28 Jun 2020, 08:54
Re: How to handle duplicate login
Hi
I tried to implement it according to your suggestion above.
When I turn-off wifi (moving to mobile data) onConnectionLost triggers immediately with reason "unknown" before connectivity monitor detect network switch operation (I tried only Android for now).
Can you explain why we get connectionLost immediately?
Thanks
I tried to implement it according to your suggestion above.
When I turn-off wifi (moving to mobile data) onConnectionLost triggers immediately with reason "unknown" before connectivity monitor detect network switch operation (I tried only Android for now).
Can you explain why we get connectionLost immediately?
Thanks
Re: How to handle duplicate login
It just depends on what happens at the lower level in the OS TCP stack.
Depending on the TCP implementation you can get an immediate disconnection, nothing, a delayed disconnection etc...
Cheers
Depending on the TCP implementation you can get an immediate disconnection, nothing, a delayed disconnection etc...
Cheers
Who is online
Users browsing this forum: No registered users and 141 guests