Connection Resiliency Always Returns AUTH_ERROR on Windows Runtime

0 votes

Hello,

I am developing an application for Windows Runtime (Windows Phone 8.1 and Windows 8.1) using the AppWarp SDK and I have activated the connection resiliency functionality by setting the Recovery Allowance time to 120 seconds (2 minutes), but whenever I get a CONNECTION_ERROR_RECOVERABLE error in my OnConnectDone callback and I call RecoverConnection() I always get an AUTH_ERROR even though I am definitely inside the recovery time. Is this a bug in the AppWarp SDK possibly?

UPDATE: The probem seems to be stemming from calling RecoverConnection() too fast after a disconnect because when I add a wait for a second it seems to re-connect fine. But if I try to make a call to GetLiveRoomInfo after re-connecting it always fails for some reason so re-connecting is still not working correctly on WinRT.

Side note: The method RecoverConnectionWithSessioId is mispelld in the SDK (it is missing the 'n' in "Session") and should probably be updated.

asked Dec 24, 2014 in AppWarp by feraask (45 points)
edited Dec 29, 2014 by feraask
Hi,

Can you please download the latest SDK and then try running your game again. The latest version will also give you a ReasonCode in case of AUTH_ERROR. This will help us to understand why you are getting AUTH_ERROR.

Thanks for pointing the spelling mistake. We will correct it :)

Thanks
Alright so I checked the reason code and the value is 0.

Also, it seems to be working fine if I don't call RecoverConnection() right away, I added a wait for 5 seconds before calling RecoverConnection() when a CONNECTION_ERROR_RECOVERABLE happens and it seems to re-connect fine (so it could be a bug in the SDK or it could be the fact that the RecoverConnection call is happening too fast before the internet connection can switch as the way I am testing it is starting out connected to Wi-Fi and then turning off Wi-Fi and letting it re-connect using cellular data).

I am now having another problem though, right after I re-connect successfully I receive a onUserResumed notification for the reconnecting player and I try to call GetLiveRoomInfo() again so that the player who was disconnected can get the latest room info but I keep getting a BAD_REQUEST error response to this call. Do I have to wait a specific time before I can get the room info after reconnecting?

What is strange though is that I am able to receive a private update right after re-connecting as I have it set so that when a player re-connects another player sends them a private update with some more info and I am receiving the update. So it seems like when a session is recovered something in the WarpClient instance is not being updated properly so that when I call GetLiveRoomInfo it returns an error.

1 Answer

0 votes

Hi Feraask,

You may get a BAD_REQUEST error only in one scenario i.e. when you are passing an invalid room id as the parameter to the GetLiveRoomInfo() API.

You can debug and check the room id being passed.

Let us know if you face any other problem with the code.

Thanks

Kanika Mittal

AppWarp Team

 

answered Dec 29, 2014 by kanika mittal (50 points)
I have checked the room id right before calling GetLiveRoomInfo and it is the same ID as it was before the player got disconnected so I know it is valid. Also the room still exists for sure since there are players still playing in the room. I am also able to re-connect to the game by manually disconnecting and then calling Connect, GetLiveRoomInfo, Join, and Subscribe to this same room id and it works fine. So there is definitely something weird going on when I try to call GetLiveRoomInfo directly after recovering my connection and getting the onUserResumed call
We have checked the APIs on our end and we could not reproduce the problem that you described.Please send us the source code of your application on support@shephertz.com.We will try to solve your problem.
What version of AppWarpWinRT are you using? As I have no idea what else could be going wrong, I am checking that the room id being passed is valid and I am connected as this is in the OnUserResumed call after re-connecting, the rest of it is in the API.
Hi,
You are using an older version of the AppWarpWinRT.The latest version is 1.10.Please download and use it.
Regarding the BAD_REQUEST error,I recommend you to call GetAllRooms API before calling the GetLiveRoomInfo API so that you can see what all rooms exist currently.Also check if you are passing the cleanupTime parameter while calling the CreateRoom API as the default time for a room to get destroyed (when inactive) is 60 min but if you are passing any other cleanupTime,the problem might be due to that.
Okay so I have updated to the latest version and I've pinpointed the problem. I have setup print statements just about everywhere and what is happening is that the user that is trying to recover is getting the onUserResumed notification before the ConnectionSuccess callback from recovering the connection so when I try to call GetLiveRoomInfo inside the onUserResumed notification the local connection is still not fully finished restoring yet.

I was assuming that once I get the onUserResumed callback that I am already re-connected but it seems this is not the case. I'm not sure if this is a bug in the SDK or if this how it is supposed to work? I think it makes more sense for the onUserResumed (or any other notification for that matter) to only arrive after you get the connection recovered successfully callback.

Here is the print statements I have where it is clear to see that the resumed notification (where I call GetLiveRoomInfo) is coming in right before the connection recovered :
- recovering connection...
- player resumed
- getting LiveRoomInfo
- connection recovered
- Error getting LiveRoomInfo

In any case it is working now as I am waiting in the onUserResumed notification until the WarpClient connection state is set to connected before calling GetLiveRoomInfo
The user that is trying to recover and hasn't recovered successfully will not get the OnUserResumed notification.The user who has recovered from a connection loss will not receive the OnUserResumed notification.Instead, the other users who have subscribed to that lobby or room will get the OnUserResumed notification when his connection gets resumed.
Unless your connection state is CONNECTED, GetLiveRoomInfo will give a BAD_REQUEST.So you should check you connection state before calling the GetLiveRoomInfo API.
Alright that means there is a bug in the SDK as the user who has recovered is getting the OnUserResumed between the time RecoverConnection is called and receiving the SUCCESS_RECOVERED callback and they should not be receiving the OnUserResumed call at all.
The user cannot get the OnUserResumed callback unless the connection state is CONNECTED.It's quite possible that you are calling an API improperly.Please share your project with us so that we can guide you where exactly the  problem lies.

Thanks
Please see my code here for a sample of the problem:
https://bitbucket.org/feraask/appwarptest_winrt/get/42d7c8a03812.zip
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...