Sign In Register

How can we help you today?

Start a new topic
Answered

End Session problem

 Hi

i have a problem with RtSession.i want to destroy my entire session after one player leave the stage and exit the stage.

i setup the simple code in cloudcode but i don't know it work or not.


RTSession.onPlayerDisconnect(function(player){
  var players = RTSession.getPlayers();
  for (var i = 0; i < players.length; i++) {

  RTSession.newRequest().createEndSessionRequest().setPlayerId(playerPlayerId).send(function(response){

  var rtDataToSend = RTSession.newData().setString(1, response.userId);
 
  RTSession.newPacket().setOpCode(101).setData(rtDataToSend).send();
  })
  }
});


thanks,




is there any way to end session automatically?

 

End session for player, or end session as in kick everyone out?

my major problem is end session as in kick everyone out. because always get session already started, after match found.

i managed the End session for player on OnpeerDisconnect function.

 I supplied a link for you shortly after my last response, but this silly forum filtered it for approval.. so I guess just wait for mods to approve post. Or read email, because unapproved posts will still get emailed.

 thanks Christopher,

you mean check my email inbox to get your link?

They finally approved the post, so you can just look above.

 

Hi, I'm having a similar session disconnect problem. Im following the gamesparks real time multiplayer example. I have a game that takes two players. (player 1 and player 2 for this example)

Both search for a game

When match found game starts

Then when either player desconnects - lets asume in this case player 1 (shuts application down) I call GameSparksManager.Instance ().GetRTSession ().Disconnect ();

and send the player that didnt disconnect (player 2) to the lobby scene.

now player 1 starts game again, searches for match and gets match found message

but when player 2 searches for match, it doesnt find a match. just keeps searching for match.

I also tried kicking player through cloud code but same effect.

So What I asume I need is to destroy the match session because the call to GameSparksManager.Instance ().GetRTSession.Disconnect () i thinks leaves the session open and linked to a player.

Any comments on how can I go about this?



Login to post a comment