[Unity] - Connection resiliency functionality isn't working

0 votes
Hi,

I'm troubling to use connection resiliency functionality of appwarp.
I used both API methods RecoverConnectionWithSessionID() and tried to connect after setRecoveryAllowance()

In first try I stored the sessionID of last succesful connection and tried to reconnect with it. But RecoverConnectionWithSessioId() didn't trigger onConnectDone.
Below is the code piece that I used:

    WarpClient.initialize(apiKey, secretKey);
    WarpClient.setRecoveryAllowance(60);
    WarpClient.GetInstance().AddConnectionRequestListener(listen);
    WarpClient.GetInstance().AddLobbyRequestListener(listen);
    WarpClient.GetInstance().AddNotificationListener(listen);
    WarpClient.GetInstance().AddRoomRequestListener(listen);
    WarpClient.GetInstance().AddUpdateRequestListener(listen);
    WarpClient.GetInstance().AddZoneRequestListener(listen);      
    ...
    sessionID = LoadSessionID();
    if(sessionID != 0)
        WarpClient.GetInstance().RecoverConnectionWithSessioId(sessionID, FB.UserId);
    else
        WarpClient.GetInstance().Connect(FB.UserId);        
        
I also tried to reconnect without storing the sessionID. Though I recieved OnConnectDone event I got result code AUTH_ERROR instead of CONNECTION_ERROR_RECOVERABLE.
Below is the code piece:

    WarpClient.initialize(apiKey, secretKey);
    WarpClient.setRecoveryAllowance(60);
    WarpClient.GetInstance().AddConnectionRequestListener(listen);
    WarpClient.GetInstance().AddLobbyRequestListener(listen);
    WarpClient.GetInstance().AddNotificationListener(listen);
    WarpClient.GetInstance().AddRoomRequestListener(listen);
    WarpClient.GetInstance().AddUpdateRequestListener(listen);
    WarpClient.GetInstance().AddZoneRequestListener(listen);
    
    WarpClient.GetInstance().Connect(FB.UserId);  

My execution step was:
1) Connect()
2) Join a room or create a new one
3) subscribe to room
4) Close the app from android's task manager
5) Run the app and try to reconnect.

I am using the latest sdk.

Do you have any idea what may cause this?
asked Aug 13, 2014 in AppWarp by terdogan (22 points)

1 Answer

+1 vote
 
Best answer
Hi

I think you are using AppWarpUnityMobile.dll,We have updated the dll after a bug fix.Please find the latest dll from below link

https://github.com/shephertz/AppWarpUnity/tree/master/v1.7.5

Incase you can refer the blog on this issue from below link

http://blogs.shephertz.com/2014/07/25/appwarp-restore-session-app-crash/

or sample from below link

https://github.com/rahulpshephertz/RestoretheSessionafterCrash/tree/master/UnitySample

Please let me know if your problem still exist.
answered Aug 14, 2014 by errahulpanchal (169 points)
selected Aug 22, 2014 by terdogan
Right now when I try to Connect(userID) after shutting down the app, I am getting "WarpReasonCode.WAITING_FOR_PAUSED_USER". Does this mean I am reconnected?

Also RecoverConnectionWithSessioId() still not triggering onConnectDone.
"WarpReasonCode.WAITING_FOR_PAUSED_USER" means your last session is still alive,In this case you should call RecoverConnectionWithSessioId(),It will resume the user to his last session.

Have you checked the below sample
https://github.com/rahulpshephertz/RestoretheSessionafterCrash/tree/master/UnitySample

It is working fine in sample.
It's working now.

Yes, I checked the sample and that's why I asked. In the sample there isn't anything done other than logging.

    if (e.getReasonCode () == WarpReasonCode.WAITING_FOR_PAUSED_USER) {
        Log ("Auth Error:Server is waiting from previous session");
    } else {
        Log ("Auth Error:SessionId Expired");
    }

Thx
In our sample RecoverConnectionWithSessioId() is triggering the OnConnect,isn't it?
Yes but RecoverConnectionWithSessioId() is manually called by user when clicked on a button. Not after e.getReasonCode () == WarpReasonCode.WAITING_FOR_PAUSED_USER.

Thats why I didn't understand use of "WAITING_FOR_PAUSED_USER". It's clear for me know.
oh...you can also call it from there.its up to you how do you want use it.Choose any one way.Sample was just for the brief idea of apis.

When user come back to the application either you can call RecoverConnectionWithSessioId() or Connect() api and OnConnect code should be like below one

 if (e.getReasonCode () == WarpReasonCode.WAITING_FOR_PAUSED_USER) {
        Log ("Auth Error:Server is waiting from previous session");
        RecoverConnectionWithSessioId();
    } else {
        Log ("Auth Error:SessionId Expired");
        Connect();
    }
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
...