Page 1 of 1

Session Reconnection failure

Posted: 27 Aug 2019, 08:28
by balasourav
27 Aug 2019 | 13:53:31,212 | WARN | SFSWorker:Sys:1 | controllers.v290.SystemReqController | | com.smartfoxserver.bitswarm.exceptions.SessionReconnectionException: Session Reconnection failure. Time expired for Session: { Id: 49, Type: DEFAULT, Logged: Yes, IP: 127.0.0.1:37424 }
com.smartfoxserver.bitswarm.sessions.DefaultReconnectionManager.reconnectSession(DefaultReconnectionManager.java:154)
com.smartfoxserver.bitswarm.sessions.DefaultSessionManager.reconnectSession(DefaultSessionManager.java:383)
com.smartfoxserver.v2.controllers.system.Handshake.execute(Handshake.java:68)
com.smartfoxserver.v2.controllers.v290.SystemReqController.processRequest(SystemReqController.java:172)
com.smartfoxserver.v2.controllers.v290.SystemReqController.enqueueRequest(SystemReqController.java:127)
com.smartfoxserver.bitswarm.io.protocols.AbstractProtocolCodec.dispatchRequestToController(AbstractProtocolCodec.java:39)
com.smartfoxserver.v2.protocol.SFSProtocolCodec.dispatchRequest(SFSProtocolCodec.java:133)
com.smartfoxserver.v2.protocol.SFSProtocolCodec.onPacketRead(SFSProtocolCodec.java:90)
com.smartfoxserver.v2.protocol.binary.BinaryIoHandler$1.run(BinaryIoHandler.java:477)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)


I got this WARNING At the time of re-connection. I Explain What i am done.
I develop timer based game, in my game 1st i connect sfs using router 1 connection. In between game-play i try to connect router 2 network connection at the time re-connection failed. I got this warning. What can i do for this type of warning? and how to overcome this re-connection failure error.

Re: Session Reconnection failure

Posted: 27 Aug 2019, 13:57
by Lapo
Hi,
the reconnection can be done if the User is using the same IP address. If change router in the middle of a session you'll change IP address as well, which won't work.

Also, generally speaking, this should not be an issue as normally people don't change routers while playing.

Cheers

Re: Session Reconnection failure

Posted: 28 Aug 2019, 13:48
by balasourav
I clearly Explain My scenario -
I have 2 wifi(wifi 1 and wifi 2) connection, Both of them in auto connect. if in-between game wifi 1 is disconnected wifi 2 automatically connected, at this time session re connection failure error is occur. Any possible ways there to solve this type of error ?

Re: Session Reconnection failure

Posted: 28 Aug 2019, 15:14
by Lapo
Hi,
no switching network card is not supported. The reconnection system has to make sure that a client wanting to reconnect is actually who he says he is. Because of this, this particular scenario won't work.

This is akin to switching network on a mobile device. If you want to learn more about these topics I'd highly recommend these articles from our blog:
https://smartfoxserver.com/blog/what-re ... tworkwifi/
https://smartfoxserver.com/blog/handlin ... e-devices/

Hope it helps

Re: Session Reconnection failure

Posted: 16 Sep 2019, 06:51
by marsoups
Can I suggest that for a future upgrade, Smartfox moves to a sort of cookie based solution where the cookie identifies the user rather than the IP and connection ? It might help with development in this age where people are on phones and moving about so much. It will make retaining a connection so much easier.

Re: Session Reconnection failure

Posted: 16 Sep 2019, 07:45
by Lapo
marsoups wrote:Can I suggest that for a future upgrade, Smartfox moves to a sort of cookie based solution where the cookie identifies the user rather than the IP and connection ? It might help with development in this age where people are on phones and moving about so much. It will make retaining a connection so much easier.

It's not that easy.
A TCP connection can be in states where it is only half-disconnected, and usually mobile devices suffer from this more than anything else.
The difficult part is determining whether the previous connection is dead or not. If the TCP doesn't trigger the event, you can get those temporary "what the heck is happening" moments, where one of the two sides is not really connected but there's no way of knowing (until a later timout triggers)

The idea of running a "cookie" works fine with a system where every request opens a connection, does its thing and then closes it. Such as in HTTP, where latency is much less of a priority than multiplayer games.

Also we already employ a cookie-like approach for the reconnection system, so that another connection can be used by the same player who lost connection earlier.

Hope it helps