question

Muhammad Roshaan Tariq avatar image
Muhammad Roshaan Tariq asked

How to check how many sessions each player has opened?

Hi, I want to know if there is any way I can check that how many sessions each player has opened in my game?

For example, one player has logged-in one account on two different devices.

I want to remove their previous sessions whenever they login again. Can I do that?

Account ManagementAuthentication
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
joel-3 avatar image
joel-3 answered

You could store an ID for the machine they log in with, in their user data.

Wherever you have a login occur, run a cloud script after to check if this is a new machine ID, if it is, write the new data over the top of the previous.

If your intention is to 'auto-logout' users once someone signs in on the same account elsewhere, you can have your application run a background script that constantly sanity checks against the current userData stored, to see if their machineID, still matches the stored ID. If not, someone has logged in elsewhere, and prompt them however you see fit.

8 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Muhammad Roshaan Tariq avatar image Muhammad Roshaan Tariq commented ·

If they have logged-in on two devices at a time, does that effect their experience with Playfab?

Because I was using Playfab's GetTime API and some times it returns the redundant data and that's when it came into mind that it might be because of their multiple logins.

0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang Muhammad Roshaan Tariq commented ·

Did you use the Server API GetTime, not the Client one? What does "redundant data" look like? Could you provide some examples?

0 Likes 0 ·
Muhammad Roshaan Tariq avatar image Muhammad Roshaan Tariq Muhammad Roshaan Tariq commented ·

@Sarah Zhang https://community.playfab.com/questions/30976/redundant-datetime-value.html?childToView=31059#comment-31059

This is my old ticket for redundant dateTime value but it is still happening some times not all the times.

And I'm using Client GetTime

0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang Muhammad Roshaan Tariq commented ·

I tried to create two session tickets, and use them separately to call the GetTime Client API. It works OK. I am unable to reproduce it.

In addition, session tickets can't be disabled manually by game developers currently. It would be disabled automatically after 24 hours.

So, When you get the incorrect data, did you make sure you get the response successfully? I'm not sure what's the reason that caused your problems. If you think it's caused by multiple sessions based on one player account. You can try to use Server API GetTime, you can use it on CloudScript.

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.