Webhooks questions

JohnTube
JohnTube ✭✭✭✭✭
Hi guys I hope I'm not bothering anyone with my questions. Can someone help me with the webhook arguments :

- GameCreate :
Correct me if I'm wrong, if Type === "Load" we should return an object containing a "State" key with a value. I want to know if its value should be exactly the same as the one included in the GameClose webhook with Type === "Save" OR there are particular keys that need to be there to re-create the Room and restore its Properties. In other words, should I save and load the State -as is-/"plain text" like in the Memory game Demo ?
Regarding the "State", I'm supposing that "DEBUG_PROPERTIES_18", "DEBUG_EVENTS_19" and "DEBUG_BINARY" can be removed when switching to "release build" ?

- GameClose :
The difference between Type === "Save" and Type === "Close", the 2nd one is when "ActorCount" === 0 and no "State" key is not present, but which use case can produce such thing ? I also want to know the use of "State2".

- GameLeft : (Type === "Leave")
There is a Reason key that can have at least the values "0", "100" and "ManagedDisconnect"...more details please !

Thanks for your time and consideration,
HL aka JT

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Answers to the above questions can be found in the comment here.

    edit : More questions :
    - Is there an ETA for the release of the next version of the SDK and the changes in Photon Cloud ?
    - How to get the even type in the GameEvent webhook if the CustomEventCode is not exposed ? The only workaround is to have a separate key/value for type in the event Data.
  • Hi John,

    we are planing to make a release this week. Which will include
    - a fix for the missing event code
    - a fix for the LeaveReason
    but
    - will not include any other change in the api.

    The other changes I'm announcing in the comments on your page - are going to take somewhat longer - since they are breaking
    - the rename of username to nickname
    - and clients have to be updated to - to allow using certain features (e.g. sending state in raiseevent - only when flag set)

    We will inform on how to upgrade - when all is ready.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Is it normal that CreateOptions.CustomProperties is always empty in GameCreate webhook although I'm always initializing it with values during creation ? And this can't be the "ExpectedCustomProperties" used for matchmaking filtering.
    Anyway, I'm looking for a way to access custom properties from Webhooks other than "DEBUG_PROPERTIES_18" that is for debugging purposes and will vanish in your next "major" update.
  • Hi John,

    assuming you are not setting "CustomRoomPropertiesForLobby", that is expected yes.

    If you send for instance this set of CustomRoomProperties:
    [code2=csharp]myRoomOptions.CustomRoomProperties = new Hashtable
    {
    { "prop1Key", "prop1Val" },
    { "prop2Key", "prop2Val" },
    { "lobby3Key", "lobby3Val" },
    { "lobby4Key", "lobby4Val" },
    };[/code2]

    And also set CustomRoomPropertiesForLobby like this
    [code2=csharp]myRoomOptions.CustomRoomPropertiesForLobby = new string[] { "lobby3Key", "lobby4Key" };[/code2]

    prop1Key and prop2Key will NOT be included in the CustomProperties in the webhook.
    but
    lobby3Key and lobby4Key will be included. And the result looks like this:

    [code2=javascript]{
    "ActorNr": 1,
    "AppVersion": "",
    "AppId": "......",
    "CreateOptions": {
    "MaxPlayers": 4,
    "LobbyId": null,
    "LobbyType": 0,
    "CustomProperties": {
    "lobby3Key": "lobby3Val",
    "lobby4Key": "lobby4Val"
    },
    "EmptyRoomTTL": 0,
    "PlayerTTL": 2147483647,
    "CheckUserOnJoin": true,
    "DeleteCacheOnLeave": true,
    "SuppressRoomEvents": false
    },
    "GameId": "MyRoom",
    "Region": "....",
    "Type": "Create",
    "UserId": "MyUserId0",
    "Username": "MyPlayer0"
    }[/code2]

    If you see the turnbased demo that's what we do there too.

    Note: the "Debug info" is going to be there but might be renamed - as to how we plan to turn it off - we will "turn it off" for applications that go live with more than 20ccu (which is the free subscription).
  • JohnTube
    JohnTube ✭✭✭✭✭
    Ok understood !

    So if I need to get some or all CustomRoomProps in GameCreate webhook I must set the CustomRoomPropertiesForLobby keys to some or all the CustomRoomProps keys !

    Note regarding the "DebugInfo" : what about Photon users that get it from PlayFab's premium tier ?
  • > Note regarding the "DebugInfo" : what about Photon users that get it from PlayFab's premium tier ?

    Good point! Thanks for that one. Don't know jet.
  • JohnTube
    JohnTube ✭✭✭✭✭
    I've seen in the Photon CustomAuthentication implementation repo that you provided info about what should be returned to Photon server :
    The result has to be in Json format with the following values:

    { ResultCode: 1, Message: "optional Auth OK message" }

    { ResultCode: 2, Message: "optional Auth Failed message" }

    { ResultCode: 3, Message: "optional Parameter invalid message" }

    Is there something similar (other than the Parse/Webscript/WAWS/Heroku samples) for the Webhooks ?

    What I actually managed to get from the github repos :
    {ResultCode:0, Message:""} // success
    {ResultCode:1, Message:"Missing GameId."}
    {ResultCode:1, Message:"Missing State."} // Heroku.GameClose
    {ResultCode:2, Message:"Missing UserId."} // GameCreate, GameLeave
    {ResultCode:2, Message:"Missing State."} // Parse.GameClose
    {ResultCode:3, Message:"GameId not Found."}
    {ResultCode:4, Message:"Missing Type."}
    {ResultCode:15, Message:"Game already exists."} // Parse
    {ResultCode:5, Message:"Game already exists."} // Heroku