userReconnectionSeconds setting

Post here your questions about the Java client / Android API for SFS2X

Moderators: Lapo, Bax

pantinor
Posts: 17
Joined: 19 Jan 2012, 02:10

userReconnectionSeconds setting

Postby pantinor » 20 Jan 2012, 01:14

Hi,

I am trying understand how the reconnection setting works.

Is it up to the client to automatically reconnect every XX seconds to avoid the idle timeout connection disconnect?

How is the setting userReconnectionSeconds on the server being used, or is it something for only the client to do by itself?
Thanks.

I am seeing something like this below and not sure why.


Code: Select all

20:24:01,338 INFO  [SocketReader] core.SocketAcceptor     - Session created: { I
d: 6, Type: DEFAULT, Logged: No, IP: 127.0.0.1:54300 } on Server port: 9933 <---
> 54300
20:24:02,243 INFO  [com.smartfoxserver.v2.controllers.SystemController-1] sessio
ns.DefaultSessionManager     - Session removed: { Id: 6, Type: DEFAULT, Logged:
No, IP: 127.0.0.1:54300 }
20:24:02,245 WARN  [com.smartfoxserver.v2.controllers.SystemController-1] contro
llers.SystemController     -
com.smartfoxserver.bitswarm.exceptions.SessionReconnectionException: Session Rec
onnection failure. The passed Session is not managed by the ReconnectionManager:
 java.nio.channels.SocketChannel[connected local=/127.0.0.1:9933 remote=/127.0.0
.1:54300]
        com.smartfoxserver.bitswarm.sessions.DefaultReconnectionManager.reconnec
tSession(DefaultReconnectionManager.java:134)
        com.smartfoxserver.bitswarm.sessions.DefaultSessionManager.reconnectSess
ion(DefaultSessionManager.java:376)
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 20 Jan 2012, 21:21

Hi.

The user reconnection timeframe setting in the Zone's configuration is the amount of time (in seconds) that the server will wait for the user to connect again. If the user doesn't connect again in that amount of time, the server disconnects that user and he isn't able to reconnect. That's why you're getting that error, because the client is sending the "reconnect" request after that timeframe has expired.

Please try increasing that setting for some reasonable values, like 30-60 seconds (depending on the game)
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
pantinor
Posts: 17
Joined: 19 Jan 2012, 02:10

Postby pantinor » 21 Jan 2012, 04:07

OK I am using this and still seeing the disconnections.

<userReconnectionSeconds>60</userReconnectionSeconds>
<overrideMaxUserIdleTime>90</overrideMaxUserIdleTime>

Doesn't this mean that the client will reconnect after 60 seconds?

Do i need to explicitly program the client to reconnect in less than that time frame?

I thought the client reconnection part was automatic with the server side setting on the zone.

thanks again.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 21 Jan 2012, 19:56

Oh, sorry, I misunderstood how the system worked :oops:

Yes, you're right, the user reconnection timeframe setting is the amount of seconds which the client will be trying to reconnect to the server (which is automatically done on the background). After this time has passed, the server will no longer accept connection retries from that specific session.

Now if you were disconnected for being idle, yes the reconnection system won't activate, otherwise, what would be the purpose of disconnecting idle users if they were always reconnecting again?

To prevent disconnection for being idle you have to send a simple message (it can be an empty extension request) at a specific rate (a bit faster than the time you have set in the Zone for the idle disconnection).
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
pantinor
Posts: 17
Joined: 19 Jan 2012, 02:10

Postby pantinor » 22 Jan 2012, 00:23

The disconnect reason is reason "unknown" so it is not idle timeout, which is set to 90 anyway.

I added a sfs.connect command into the CONNECTION_RETRY event handler and this does not help either.

What is going on? How can I do the reconnect? thanks.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 22 Jan 2012, 19:09

Please don't call the connect() method again on the CONNECTION_RETRY event, as I said, the reconnection is done automatically on the background. If the reconnection is successful, you get a CONNECTION_RESUME event, otherwise, you get a CONNECTION_LOST one.

Please make sure that you're running the latest server and client API, to make sure you aren't facing an already solved bug.

Also please provide more details, like when does that disconnection happen, what do you do for it to happen, etc.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 24 Jan 2012, 13:09

I'm tracking some issues in the reconnect system for C# API - which then most likely are also existing in the Java API.

Please stand by!

/T
Full Control - maker of Unity/C# and Java SFS API and indie games
Follow on twitter: http://twitter.com/thomas_h_lund

Return to “SFS2X Java / Android API”

Who is online

Users browsing this forum: Baidu [Spider] and 65 guests