Keep AppWarp connection alive in background (Windows Runtime 8.1)

0 votes
Hello,

I am developing an application for Windows 8.1 and Windows Phone 8.1 using the Windows Runtime (WinRT) and I would like to know if there is a way to maintain a connection to AppWarp when the application goes into a suspended state? As of right now the OS will restore the entire memory state of the application if it was only suspended but I am still getting disconnected from AppWarp when I resume (which is understandable since applications do not stay running in the background on Windows Runtime and thus the connection cannot be maintained).

Basically I would like to know a good way to handle resuming the connection when the application is returning from a suspended and/or terminated state?

I could easily just make it so the application resets back to the main page every time it resumes but it would be nice if there was a way to actually restore the connection to AppWarp. Would this be handled by implementing connection resiliency from the AppWarp API?
asked Jun 4, 2014 in AppWarp by feraask (45 points)

1 Answer

0 votes
Whenever your app goes background, the system itself breaks the connection. This happens with all mobile devices like android, iOS or WP, every time the app goes backrougd or screen is locked, the socket connection gets broken.

Therefore we provide connection resiliency, to let you recover your lost conenction. Simlply set the recovery allowance in warpclient before connection. You have to specify for how many seconds you want the server to keep connection alive even when connection has been broken. Then whenever your connection is broken, you will get onConnectDone with Connnectio Error Recoverable result code, there you can call the recoverConnection method to recover the lost connection.

But you must remember you won't be able to recover connection that have been lost for longer duration. You will need to connect again to server.
answered Jun 5, 2014 by Suyash Mohan (900 points)
Okay I understand this. So basically what I want to be able to handle is this: If a user is playing the game and they minimize the application to the background for some reason I will get the onConnectDone callback with the Connection Error Recoverable error code, but will this callback happen when the user returns to the application? Or does it happen immediately when the app is suspended into the background (which means if I try to reconnect right away it would fail because the app is in the background)? I just want to know how/when I should call the RecoverConnection() method?

What I am thinking is recording the time I get the onConnectDone call back with the error code and then in the onResume call when the user returns back to the application I check if it is within the recovery time and then call RecoverConnection() if it is within this period, otherwise I have to connect and start a new session. Is this correct? Or can I call RecoverConnection immediately in the callback so that I can handle connection errors that happen when the user's internet connection drops?
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
...