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
HRC
Re: HRC
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
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
- A51Integrated
- Posts: 240
- Joined: 03 Jan 2012, 19:55
- Location: Toronto, Canada
- Contact:
Re: HRC
Have you tried setting the reconnection delay on the client (in Milliseconds)?
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.
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
http://a51integrated.com / +1 416-703-2300
Re: HRC
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.
It still seems like a bug, however, that an HRC connection resume event happens after a connection lost event has already happened.
Re: HRC
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
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
Re: HRC
BlueBox seems like the ultimate solution for those shaky connections.
Re: HRC
@mmilen: not sure what BlueBox http tunneling has to do with this (shaky connections)?
Re: HRC
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