Hi, we're trying to handle disconnects more gracefully in our game using a Flash client. I've read about the HRC and how it should reconnect automatically. In our server config, I've set:
<userReconnectionSeconds>60</userReconnectionSeconds>
<overrideMaxUserIdleTime>90</overrideMaxUserIdleTime>
So, according to my understanding, this should reconnect automatically if possible within 60 seconds and then disconnect the user if no response is received from them in 90 seconds.
I'm testing this by disabling my network connection on the client. What happens is this:
- The client immediately detects a dropped connect.
- It receives a CONNECTION_RETRY event.
- It then immediately receives a CONNECTION_LOST event.
Although it listens for CONNECTION_RESUME, it never gets this event, even if the network connection is immediately restored.
On the server side, things seem to be handled correctly in that the USER_DISCONNECT event isn't fired until after about 90 seconds.
What do I need to do to make the reconnect happen? Should I try to reconnect manually in response to the CONNECTION_LOST event? Is there something else I should be configuring in the client to make it try to reconnect automatically?
We're using the Bits Connector object to make the initial connection. Does this perhaps affect what's going on?
Thanks for any help!
Reconnection attempt failing - what to do?
Sorry I probably missed your initial steps.
You turn off the network and then turn it on again but the API are much faster than you. They find no connectivity at all and fail, causing a full disconnection.
In the real world we would expect that your network is congested or your ISP has temporary hiccups. This is what happens:
1- Disconnection: API detect the problem and fire a new connection
2- The underlying OS TCP stack attempts the connection... due to the congestion you need to wait 15 seconds before the new connection is established
3- Connection is up again: CONNECTION_RESUME event is fired
The problem with your test is that you remove the whole network physically. This is not supported and there's no real use case for this.
Hope it helps
In this case it won't work, sure. Now I get it.- The client immediately detects a dropped connect.
- It receives a CONNECTION_RETRY event.
- It then immediately receives a CONNECTION_LOST event.
You turn off the network and then turn it on again but the API are much faster than you. They find no connectivity at all and fail, causing a full disconnection.
In the real world we would expect that your network is congested or your ISP has temporary hiccups. This is what happens:
1- Disconnection: API detect the problem and fire a new connection
2- The underlying OS TCP stack attempts the connection... due to the congestion you need to wait 15 seconds before the new connection is established
3- Connection is up again: CONNECTION_RESUME event is fired
The problem with your test is that you remove the whole network physically. This is not supported and there's no real use case for this.
Hope it helps
Thanks again Lapo.
I will test with killConnection(). Am I right in saying that if one experienced a network dropout due to a faulty internet connection or problems at the ISP one would expect an automatic reconnection if the glitch is resolved within the <userReconnectionSeconds> period?
We'll also upgrade to RC3.
I will test with killConnection(). Am I right in saying that if one experienced a network dropout due to a faulty internet connection or problems at the ISP one would expect an automatic reconnection if the glitch is resolved within the <userReconnectionSeconds> period?
We'll also upgrade to RC3.