Sign In Register

How can we help you today?

Start a new topic
Answered

Concurrent sessions (logins)

Hello, 


Let say that a single player (p) has concurrent logins and for every login session we joined that player to a new challenge with other players not in challenge already. 


In case player (p) disconnects from one of the sessions (from browser window or another device), how can we trace which session it was and then remove user from challenge created during that session or perform other tasks that are session only related.


This is just an example, there could be other various scenery where we would like to trace player and it's session. 


Is there a way to trace user session? 


Best Regards,

Sasha


Best Answer

Hi Sasha, 

GameSparks handles multiple payer instances through the use of the SparkPlayer class. The SparkPlayer Class contains a  Disconnect(bool) method for closing a players websocket. 


If you pass true as an argument it will disconnect all but the latest player instances. Passing in false will disconnect all player instances. You don;t need to track sessions as the player only exists in the challenge,while that instance will be referenced by the various sessions. All that should be needed is the ending of all other sessions.


Does this make sense? 

Best Regards, Patrick. 


Answer

Hi Sasha, 

GameSparks handles multiple payer instances through the use of the SparkPlayer class. The SparkPlayer Class contains a  Disconnect(bool) method for closing a players websocket. 


If you pass true as an argument it will disconnect all but the latest player instances. Passing in false will disconnect all player instances. You don;t need to track sessions as the player only exists in the challenge,while that instance will be referenced by the various sessions. All that should be needed is the ending of all other sessions.


Does this make sense? 

Best Regards, Patrick. 

Hello Patrick,


This makes sense in case we would want only single player session to be active and valid. Did I understood this correctly?


I was referring to multiple sessions of a single player (p) in scenery (dad plays game and let's his children play from his account):
1. Player (p) starts a game from a browser, logs in and is joined to a challenge id 1

2. Player (p) logs in from another device and is joined to another challenge id 2

3. Player (p) logs in from another browser tab and is joined to another challenge id 3

4. Player (p) exits game from device (2.) and we need to remove player (p) from challenge id 2, we do not want to remove player from challenges id 1 and 3, also we have to perform other game tasks that are related only for player in challenge id 2 and that session.


Can we do that? Is there any way to track sessions, maybe use socket number or socket transaction number (common part and variable part)?


Best Regards,

Sasha

Hello again,


I elaborated my question but there is still no answer. Should I still wait for an answer?


Best Regards,

Sasha

Hi Sasha,

Apologies for the delay. Currently the only way to handle player disconnects is through the SparkPlayer.Disconnect() class. The disconnect method takes a bool. With an argument of true, all but the current session will be disconnected, with an argument of false, all including current will be disconnected. 


There is currently no way to perform a disconnect operation on a specific session by id. 

Does this make sense? 

Best Regards, Patrick. 

Hi Patrick,


At this phase of development we needed information you gave us in order to know how to handle player logins. 


However, it would be nice if we could trace user sessions.


Best Regards,

Sasha

Login to post a comment