WarpClient.GetInstance().Connect(username); sometimes connects in seconds and sometimes go forever without connecting

0 votes
HI, I have one scene in Unity. From there in Awake I'm initializing the SDK with API_KEY and API_SECRET. I have a button in my scene clicking which it tries to connect to server using WarpClient.GetInstance().Connect(username). Sometimes I get connected to server within 2-3 seconds. And if not, then it will not get connected to server forever. I try again and again and start gettinf Bad Request Error. The I have to kill the application, re-launch and try again. If it does not work, then I re-install the application and sometimes with luck I get connected to server. I'm using 3G moiblie data to connect. I can share my unity project if required to test it out. Thanks
related to an answer for: Appwarp Connection problems in Unity 3D
asked Jun 1, 2016 in Unity by wahoplay (15 points)
Ok, I got some direction I guess. I downloaded the Github demo of Connection resilience https://github.com/SuyashMShepHertz/UnityConnectionResiliencySample.

I ran it in player and it was running good with my API_KEY and API_SECRET. Until I replaced the username from current date time in demo to hard coded "10001". Then it stopped working as in my project and stayed in the CONNECTING state forever.

Please guide me where I'm doing wrong here. How should I program if I want to connect an existing user in to the game ?

1 Answer

0 votes
Hi WahoPlay,


Can you please share the result code you are getting in onConnectDone method.

Please share the details so that we can help you in better manner.


Vishnu Garg
answered Jun 2, 2016 by Vishnu Garg (674 points)
This is my onConnectDone method, and this method is never getting called after I call Connect(username) method. If I check the getConnectionState(), it keeps returning Connecting.

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 ());
        case WarpResponseResultCode.AUTH_ERROR:
            AppWarpTest.Instance.PostLog ("Auth Error");
        case WarpResponseResultCode.BAD_REQUEST:
            AppWarpTest.Instance.PostLog ("Bad Request");
        case WarpResponseResultCode.CONNECTION_ERR:
            AppWarpTest.Instance.PostLog ("Connection Error");
        case WarpResponseResultCode.CONNECTION_ERROR_RECOVERABLE:
            AppWarpTest.Instance.PostLog ("Connection Error Recoverable");
        case WarpResponseResultCode.RESOURCE_MOVED:
            AppWarpTest.Instance.PostLog ("Resource moved");
        case WarpResponseResultCode.RESOURCE_NOT_FOUND:
            AppWarpTest.Instance.PostLog ("Resource not found");
        case WarpResponseResultCode.RESULT_SIZE_ERROR:
            AppWarpTest.Instance.PostLog ("Size Error");
        case WarpResponseResultCode.SUCCESS_RECOVERED:
            AppWarpTest.Instance.PostLog ("Success recoeverd");
        case WarpResponseResultCode.UNKNOWN_ERROR:
            AppWarpTest.Instance.PostLog ("Unknown Error");
        case WarpResponseResultCode.USER_PAUSED_ERROR:
            AppWarpTest.Instance.PostLog ("User paused error");
            AppWarpTest.Instance.PostLog ("Any error");
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