question

Hans Sjunnesson avatar image
Hans Sjunnesson asked

Best practises around session based data in Cloud Scripts

I'm investigating running multiple authentication methods on the same Playfab title - e.g. you'd be able to login using Steam, and XBox Live.

Some of the Cloud Scripts we use require us to know which platform the current request is for - a PC or an XBox. What's the best practise around getting this "session data"?

Currently - it looks like I need to write UserInternalData when I log in, and read that when I need.

CloudScript
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

·
Hernando avatar image
Hernando answered

When the player login, PlayFab will post player_logged_in event, platform information will be displayed as a property in it. So you can build a rule listens to this event and records the property "Platform" of the current player. But the Platform is simply information about which login method was used and it is not the actual client device platform. You can use this login type or write your code to let the client tell you what the platform is.

2 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.

Hans Sjunnesson avatar image Hans Sjunnesson commented ·

What kind of guarantees do we have with rules? Say my player logs in, then immediately executes a cloudscript function which cares about the platform. Is the rule guaranteed to have been completed before the player manages to execute the cloudscript function?

0 Likes 0 ·
brendan avatar image brendan Hans Sjunnesson commented ·

Event triggers occur when the event is processed in PlayStream. The average latency time usually means that the action will have fired by the time the client gets the response from the call that generated the event, but it's not a guarantee. And if you're calling a Cloud Script in the action which itself is making API calls, those will take time to complete.

0 Likes 0 ·

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.