question

kaushikbhatt avatar image
kaushikbhatt asked

Abillity to add json data in PlayStream event

We are using Snowflake and would like to capture out player data for 'x' game like a json data using PlayFAb's Playstream event. E.g:

{
    "EventName": "gamebygamelog",
    "EventNamespace": "title.A0D3",
    "EntityType": "title",
    "Source": "A0D3",
    "EventId": "7bc48a761ee94dd48dc5010f0e8a7f08",
    "EntityId": "A0D3",
    "SourceType": "GameServer",
    "Timestamp": "2018-09-04T11:05:13.2724789Z",
    "History": null,
    "CustomTags": null,
    "Reserved": null,
    "PlayFabEnvironment": {
        "Vertical": "master",
        "Cloud": "main",
        "Application": "mainserver",
        "Commit": "5cd811a"
    },
    "GameID": "xxxxxxxxxxxxxxxxxxxxx",
    "GameType": "Normal",
    "Boot": 45000,
    "Chaal": 5760000,
    "Pot_limit": 46080000,
    "Num_P": 3,
    "Players": 
	[ 
      	  { 
     	     "ID": Player ID
     	     "Type": type of player
             "SW:" wallet
             "Hand": Hand
             "Hand_Sh": Hand Strength
             "Bet": Player bet amount
             "Win": Player win amount
             "Folded": Whether folded or amount
             "Gift": Player gift spend
             "Tip": Player tip spend
           },
          {
     
          },
     
       ]
    "GameTime": 12.4036523
}


Can we post this structure of data using

PlayFabServerAPI.WriteTitleEventAsync(new PlayFab.ServerModels.WriteTitleEventRequest()
{
Body = data,
EventName = eventName
});

apis
10 |1200

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

brendan avatar image
brendan answered

Yes, when you call WritePlayerEvent or WriteTitleEvent, the Body is JSON data - specifically, a dictionary of key/value pairs. That shows up in the event in Snowflake (and the Event History page) as an object named "Payload".

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

Hamza Lazaar avatar image Hamza Lazaar commented ·

I have never seen the key "Payload" in any PlayStream event in the Event History page.
The key/value pairs of the custom dictionary are added to the top level/root object of the PlayStream event along with PlayFab's default key/values. By the way, could you check if those are counted in the 1000bytes free limit, I think they do, which is not fair IMO as a lot of them are useless from a developer's point of view.

0 Likes 0 ·
Andy avatar image Andy ♦♦ Hamza Lazaar commented ·

The Payload field appears in the PLAYSTREAM_ARCHIVE_SHARED table in Snowflake as the "P" field, not in PlayStream. In PlayStream all custom event properties appear inline alongside boilerplate properties.

Also, no, we don't count the boilerplate against the 1024 byte limit. We explicitly measure the byte count of the request payload prior to adding it to the full PlayStream event.

0 Likes 0 ·
Hamza Lazaar avatar image Hamza Lazaar Andy ♦♦ commented ·

Thank you @Andy
I did some tests, it seems the limit is 1000 characters, 1000 bytes and not 1024 characters / 1024 bytes. Could you check please?

0 Likes 0 ·
Show more comments
kaushikbhatt avatar image
kaushikbhatt answered

HI.. Related to above I've another related query...

Is there a way we can SET the

"CustomTags"

When posting events in PlayStream. I havent found any docs showing us IF and HOW can we do this

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

brendan avatar image brendan commented ·
0 Likes 0 ·
kaushikbhatt avatar image kaushikbhatt brendan commented ·

Our use case is a bit more simple.. We just want to tag the event saying whether the currency change was due to source event or a sink event.. no other info we would like to add... But as you have already said in the thread my assumption is that we wont be allowed to use it from game/server side... right?

0 Likes 0 ·
brendan avatar image brendan kaushikbhatt commented ·

Understood, but the CustomTags is part of the base class, and is for the event provider (which would be PlayFab, in this case) to add any additional tags. It's not something you can set. What I would recommend is firing your own custom event, using WritePlayerEvent.

0 Likes 0 ·
kaushikbhatt avatar image kaushikbhatt commented ·

gr8 thanks for confirming. we shall opt for that instead

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.