AppWarp Unity: Connect with same user does not work

0 votes

Hi,

I have integrated the AppWarp SDK into my Unity project and set it up as per instructions. When I run it on player or physical device it works well without any issues. So I connect a user named "10001" to the server using call

WarpClient.GetInstance().Connect("10001");

And I get connected getting a call in ConnectionListener with Success code. However, if I try to re-run the app using the same user name it does not connect the user and forever stays in connecting state. I checked the Connectivity Resilliance tutorial on Github as well. In this also, if I put the user name as static anyting e.g. "10001". It will not connect it to server.

My main objective is to register a user to server. And if user closes and re-opens the app, then I want to re-connect the same user to server to check any available games. But since the server is not letting me connect the same user again, I'm not sure how to achieve this.

Any help is greatly appreciated.

Thanks

asked Jun 2, 2016 in Unity by wahoplay (15 points) 1 flag

1 Answer

0 votes

Hi Wahoplay,

While reConnecting the same user after re-running which result code you are getting in onCoonectDone method.

Let me know the details so that I will help you in better manner.

Thnaks

Vishnu Garg

 

answered Jun 2, 2016 by Vishnu Garg (674 points)
I'm not getting call inside onConnectDone method as the ConnectionStatus is Connecting forever. Here is my onConnectDone method:

public void onConnectDone (ConnectEvent eventObj)
    {          
        switch (eventObj.getResult ()) {
        case WarpResponseResultCode.SUCCESS:
            Debug.Log ("connection success");
            AppWarpTest.Instance.PostLog ("Connection Successs");
            App42API.SetLoggedInUser (Constants.username);
            App42Push.setApp42PushListener (this);
            #if UNITY_ANDROID
            App42Push.registerForPush (Constants.GoogleProjectNo);
            AppWarpTest.Instance.PostLog (App42Push.getLastPushMessage ());
            #endif
            break;
        case WarpResponseResultCode.AUTH_ERROR:
            AppWarpTest.Instance.PostLog ("Auth Error");
            break;
        case WarpResponseResultCode.BAD_REQUEST:
            AppWarpTest.Instance.PostLog ("Bad Request");
            break;
        case WarpResponseResultCode.CONNECTION_ERR:
            AppWarpTest.Instance.PostLog ("Connection Error");
            break;
        case WarpResponseResultCode.CONNECTION_ERROR_RECOVERABLE:
            AppWarpTest.Instance.PostLog ("Connection Error Recoverable");
            break;
        case WarpResponseResultCode.RESOURCE_MOVED:
            AppWarpTest.Instance.PostLog ("Resource moved");
            break;
        case WarpResponseResultCode.RESOURCE_NOT_FOUND:
            AppWarpTest.Instance.PostLog ("Resource not found");
            break;
        case WarpResponseResultCode.RESULT_SIZE_ERROR:
            AppWarpTest.Instance.PostLog ("Size Error");
            break;
        case WarpResponseResultCode.SUCCESS_RECOVERED:
            AppWarpTest.Instance.PostLog ("Success recoeverd");
            break;
        case WarpResponseResultCode.UNKNOWN_ERROR:
            AppWarpTest.Instance.PostLog ("Unknown Error");
            break;
        case WarpResponseResultCode.USER_PAUSED_ERROR:
            AppWarpTest.Instance.PostLog ("User paused error");
            break;
        default:
            AppWarpTest.Instance.PostLog ("Any error");
            break;
        }
}
In your case, you can use recoverConnectionWithSessionID API to recover the session. This issue is coming because the app is closed so all the previous objects are getting deleted and the information needed to recover the session is not available at the client side.

In this case , you can save the sessionID in your playerPrefs just after you gets connected to the AppWarp. When you open the app just after closing it, you can recover your last session using the above api with the sessionID you have in the playerPefs.

Please let me know if you have any queries.
Hi,

Thanks for your reply. How to get sessionID after I get connected to AppWarp ?
There is an API getSessionID(http://appwarp.shephertz.com/game-development-center/csharp-api-reference/#getsessionid) to get the session id. Please let me know if you still face the problem.
Hi,

Thanks for providing the details. I'm able to connect again and again, however if I try to connect using sessionId it gives Auth Error.

Is this normal ?
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
...