Connection state changes to 0 (DISCONNECTED) after some time.

0 votes

Hi,

I am using Windows Phone latest SDK and I got logic of multiplayer game running.

Problem I started to see is that after some time in online gameplay between two players, one of the player receives a message that the other one left the room - despite that such a thing did not happen, I was testing gameplay and app was running on both devices in the foreground. I checked the connection state continously and it tourned out that connection state turned 0 (DISCONNECTED) from 1 (CONNECTED). When I checked code that was delivered in onDisconnectDone callback it was 6 (CONNECTION_ERR).

It seems to happen quite randomly - time wise - it happened already after 7, 13, 22, and 40 minutes of multiplayer gameplay.

Once it even happened that both players got diconnected about the same moment - none of them showed a message that opponent left the room and both stay in gameplay even though could not really send a move.

I see there is similar topic question or even the same already here -> http://forum.shephertz.com/?qa=943/suddenly-disconnecting-from-the-error

Is dropping connection something that I should take care of?  And what may be the reason that connection is dropped?, aside from the explaination from the wiki "This occurs if the underlying TCP connection with AppWarp cloud service got broken. The client will need to reconnect to the service and retry the operation."
 

 

asked May 13, 2014 in AppWarp by kaszarek (21 points)

1 Answer

+1 vote
 
Best answer

Yes,  connection errors is something that developers have to handle in their game. 

The common case for this to occur on mobile are the following

1) Loss of cellular data connectivity

2) Moving between internet sources (switching between different Wifi hotspots or cellular data)

3) User locking the device or pressing the home screen and putting the app in the background. (OS specific behavior).

 

The way you handle this is up to what you feel is the best in your app. Following are some common way

1) Alert the user of the interruption and exit the game play. Ask them to try reconnecting when they have internet back.

2) Show the user a busy/pause UI and automatically detect if internet connectivity is restored and reconnect and rejoin the game. In this strategy the connection resiliency feature will be useful.

 

answered May 14, 2014 by dhruvc (1,099 points)
selected Jun 2, 2014 by kaszarek
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
...