HRC

Post here your questions about the Objective-C API for SFS2X

Moderators: Lapo, Bax

brunoma
Posts: 20
Joined: 11 Jan 2012, 16:36
Location: London, Ontario, Canada

HRC

Postby brunoma » 30 Aug 2012, 01:19

The Highly Resilient Connection (HRC) system of SmartFoxServer seems like it would be a nice feature to have working on a mobile device with sometimes spotty internet connections, but I haven't been able to get this working at all.

I set the user reconnection timeframe seeing in the zone configurator to 30secs and restart the server to activate this feature. When it is active, I test connection issues on my iDevice by turning on airplane mode in the ios settings. My app receives a "connection retry" message from the SmartFox Client and then immediately receives a "connection lost" message.
If I turn off airplane mode and allow the app to reconnect to the server, I will get a "connection resume" message, but since the app thinks the connection was lost, it is in a bad state.
Following that, I get onDataRead Exceptions.

Is anyone else able to repro this behavior? I would like to get HRC working!
Thanks,

Bruno
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: HRC

Postby Lapo » 30 Aug 2012, 09:41

I think it might depend on how the iOS sockets react to a new connection attempt in iOS.
When you turn on the Airplane mode the connection gets killed, evidently, then the SFS2X API attempt a new connection (unbeknownst of the airplane mode, of course). At this point several things might happen, iOS might reply immediately... sorry no connection, byebye... or could start the connection and wait for the other end to reply.

If the first scenario happens it could explain the problem you are reporting, in that case I think we should change our strategy and continue trying for a while.

Anyway, A51Integrated is the expert here, so let's wait his opinion :)
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
A51Integrated
Posts: 240
Joined: 03 Jan 2012, 19:55
Location: Toronto, Canada
Contact:

Re: HRC

Postby A51Integrated » 30 Aug 2012, 14:29

Have you tried setting the reconnection delay on the client (in Milliseconds)?

Code: Select all

[sfsClient setReconnectionSeconds:(NSInteger)];


Try setting that to something larger (the default is 1000) like 10,000. That way, it will delay the reconnection attempt and delay the connection lost event. Once the connection lost event is thrown, the API resets the client so you would need to start a fresh session with your app.
A51 Integrated
http://a51integrated.com / +1 416-703-2300
brunoma
Posts: 20
Joined: 11 Jan 2012, 16:36
Location: London, Ontario, Canada

Re: HRC

Postby brunoma » 30 Aug 2012, 16:49

I'll give it a shot.
It still seems like a bug, however, that an HRC connection resume event happens after a connection lost event has already happened.
brunoma
Posts: 20
Joined: 11 Jan 2012, 16:36
Location: London, Ontario, Canada

Re: HRC

Postby brunoma » 11 Sep 2012, 16:02

Just an update on this:

I tried setting the reconnection timeout very high like A51Integrated suggested, but I still observed the same results. The Connection Lost event still happens right away.

Some other observations:

- The default timeout (from getReconnectionSeconds) is 0, not 1000
- The method is called setReconnectionSeconds but you said to set it with milliseconds? This needs clarification
- Setting "user reconnection timeframe" in the Zone Configurator Admin Module to turn HRC on/off requires a server restart
- The ConnectionRetry/ConnectionResume events will only happen on the client if HRC is turned on (as expected)
- The ConnectionLost Event happens immediately after ConnectionRetry when iOS is put into airplane mode, ignoring the reconnection timeout value (not expected)
- The ConnectionResume event happens even after the ConnectionLost event has already happened (not expected)
Note: this is also happening on the .Net client when i test by turning on firewall

Since the client only gets ConnectionRetry and ConnectionResume events when HRC is enabled on the server, I am assuming it gets this information when it initially connects to the server.
Shouldn't it get the user reconnection timeframe value from the server at this point as well?
- I tested this out and indeed this is the case. getReconnectionSeconds gives back the value set on the server side if it is not overriden by calling setReconnectionSeconds
mmilen
Posts: 298
Joined: 09 Nov 2010, 00:48
Contact:

Re: HRC

Postby mmilen » 13 Sep 2012, 14:46

BlueBox seems like the ultimate solution for those shaky connections.
brunoma
Posts: 20
Joined: 11 Jan 2012, 16:36
Location: London, Ontario, Canada

Re: HRC

Postby brunoma » 17 Sep 2012, 14:53

@mmilen: not sure what BlueBox http tunneling has to do with this (shaky connections)?
mmilen
Posts: 298
Joined: 09 Nov 2010, 00:48
Contact:

Re: HRC

Postby mmilen » 17 Sep 2012, 15:23

HTTP is stateless protocol , the biggest issue with HRC is actually detecting intermittent issues that break the socket. So the stateless is good, given the intermittent issue disappears with in the BlueBox timeouts.

Return to “SFS2X iPhone / iPad / OSX API”

Who is online

Users browsing this forum: No registered users and 17 guests