PublishSubscribers set false when restoring channel state.

Options
When creating a new channel, PublishSubscribers is set true, and the channel behaves accordingly.

When a channel is destroyed, we use custom webhooks to store the channel state in our servers.

Upon restoring the channel state, PublishSubscribers is set to false.

Is there a particular channel state restore flow that is required to maintain the PublishSubscribers flag property?

PhotonChat only integrated into PlayFab.

Thanks,
-Andrew

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @UBAndrew,

    Thank you for choosing Photon!

    How do you store and restore the state?
    I mean what do you save exactly and what do you load and return?
    Do you convert to string and then back to a JSON object?

    Could you log what is saved and what is restored?
  • UBAndrew
    UBAndrew
    edited April 2020
    Options
    Hi @JohnTube

    Thanks for your support.

    We only store the BinaryHistory value as a string. The rest of the ChannelState is discarded.

    In PlayFab CS Handlers:
    When closing a room: we store the ChannelState.BinaryHistory value as a string in AWS.
    When creating/subscribing: we create a JSON object with key "ChannelState", value is a JSON object with key "BinaryHistory", value is history string value from AWS.
    {
    "ChannelState" : { "BinaryHistory": "ASDF" }
    }

    e.g.
    var channelStateObject = {"BinaryHistory":String(response.history)};
    result["ChannelState"] = channelStateObject;
    

    Logging saved and restored binary history strings will required the addition of some adhoc debug hooks. I will look into it.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @UBAndrew,

    The state should contain more than just BinaryHistory.
    Make sure to also save and load BinaryProperties or optionally save PublishSubscribers / MaxSubscribers.
    When we load and set the channel state, we set the properties first from BinaryProperties (if any) then if you also provide PublishSubscribers or MaxSubscribers, we override any previous values with their respective values.

    We will update the documentation accordingly.
    Thank you for your patience and understanding!
  • UBAndrew
    Options
    Ahhh that makes sense, thanks!