Bad_Request connection error in Unity

0 votes
Hi I'm using Unity and getting error code 4 response from the following code:

WarpClient.initialize(GlobalContext.API_KEY, GlobalContext.HOST_NAME);

WarpClient.setRecoveryAllowance(60);
GlobalContext.warpClient = WarpClient.GetInstance();

Here is the code for ConnectionListener onConnectionDone()

        public void onConnectDone(ConnectEvent eventObj)
        {
            UnityEngine.Debug.Log("In ConnectionListiner onConnectionDone & response code: " + eventObj.getResult().ToString());
            switch (eventObj.getResult())
            {
                // successfully established a new connection
                case WarpResponseResultCode.SUCCESS:
                    GlobalContext.IsConnectedToAppWarp = true;
                    _recoverCounts = 0;
                    if (GlobalContext.tableProperties["IsPrivateRoom"].Equals("false"))
                    {
                        UnityEngine.Debug.Log("In ConnectionListiner onConnectDone before joinRoomWithProperties()");
                        WarpClient.GetInstance().JoinRoomWithProperties(GlobalContext.tableProperties);
                    }
                    break;
                // non-recoverable connection error
                case WarpResponseResultCode.CONNECTION_ERR:
                    UnityEngine.Debug.Log("In ConnectionListiner onConnectionDone CONNECTION_ERR & response code: " + eventObj.getResult().ToString());
                    break;
                // Indicates incorrect api and secret key pair
                case WarpResponseResultCode.AUTH_ERROR:
                    UnityEngine.Debug.Log("In ConnectionListiner onConnectionDone AUTH_ERROR & response code: " + eventObj.getResult().ToString());
                    break;
                // Recoverable connection error
                case WarpResponseResultCode.CONNECTION_ERROR_RECOVERABLE:

                    break;
                // Successfully recovered the previous connection     
                case WarpResponseResultCode.SUCCESS_RECOVERED:

                    break;
                default:
                    if (App.CurrentPage.Equals("HomePage"))
                          EventManager.ConnectionHasFailed();
                    GlobalContext.IsConnectedToAppWarp = false;
                    break;
            }
        }

Not sure why this is happening in Unity, I know server is fine and running as I can connect to it from a Windows Phone app?

Any ideas?

Thanks
asked Nov 4, 2015 in Announcements by wiredvoltage (84 points)

1 Answer

0 votes
Hi,

Error code 4 comes if the parameter passed in the request is invalid. In case of connect API, it might come if the userName passed is null or empty. Also if you are already connected on this device and trying to connect again then error code 4 will come.

Please check and let me know if this is not the case.

Thanks.
answered Nov 5, 2015 by rajeev.etc (1,660 points)
Hi Rajeev, the line:

WarpClient.GetInstance().Connect(GlobalContext.localUsername, "");
Gives me a warning that there is no overload for method that takes 2 arguments!

I was using:
WarpClient.GetInstance().Connect(GlobalContext.localUsername);
Which doesn't give me warning in VS or Mono, but it's probablly the problem then?

I'm using:
App42-Unity3D-SDK-4.1.2.dll
AppWarpUnity.dll
AppWarpUnityMobile.dll
AppWarpUnityWP8.dll

Any help here would be appreciated?

Username is not null
The device that connects was written in VS for WP (totally different app)

UPDATE
I removed the above .dll's and replaced them with the correct ones for AppWarpS2
AppWarpS2UnityMobile.dll


And getting response code 5 now, any ideas what is wrong here?

Thanks
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
...