How to switch Server Region in case Photon is down?

Options
Hello,

as probably everybody knows, EU was down yesterday for more than 2 hours -__-

How to change the Region in Photon in case this happens again?


Since I can't test this really I need to be sure that it's actually work.

Can someone post a Code Snippet?









Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @kk99,

    One solution is to use "Dashboard Regions Filtering" feature.
    Dynamically (on the fly) and explicitly choose which regions the client can connect to.

    E.g. in case of failure of a region, remove it from the list and save.

    Set "Hosting" option to "Best Region".
    Always overwrite saved preferred region in player prefs with "none" before connecting.
    PhotonNetwork.OverrideBestCloudServer(CloudRegionCode.none);
    PhotonNetwork.ConnectUsingSettings(appVersion);
  • kk99
    Options
    but how does BestRegion decide?

    I want all users to connect to EU unless EU is down.

    i dont want 40% users are playing EU, meanwhile other 20% playing US and 40% are playing somewhere else. . .


  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Regions Whitelist: "eu"
    if there is an issue with "eu", just update app config from the dashboard and set list to next preferred region e.g. "us".
  • kk99
    Options
    hmm but that is a manual process and it's awful.
    What do I do if I am sleeping lol or simply not available or not aware of an issue?



    Do you offer an API that returns some values if Regions are down?

    I am thinking to call this https://www.photonengine.com/en-US/status and parse the HTML for EU.
    and then switch Regions in Unity if in case the parsin indicates EU is down.

    if (euIsDown())
    PhotonNetwork.ConnectToRegionMaster(regionCode, gameVersion).


    any better idea?
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    I'm afraid your solution is good in theory but can't be reliable as the status page does not give you exact current status but rather the daily average for last week until "yesterday".
    So you can't avoid a manual intervention.
  • kk99
    Options
    so there is no API and basically no other Option to check if EU servers are down? . . .

    Is there at least special Exception thrown if a Region is down and you try to connect, then I could display the user an option to switch the Region
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited January 2018
    Options
    @kk99

    You may implement a monitoring system for the public cloud regions yourself as we do not provide one now.
    I can't really tell which error the server might return or which exception the client can throw.
  • Markus
    Options
    You might simply choose a different region, after e.g. 3 connection failures.
    In the end, it only matters, if a client can connect or not (for whatever reason).

    Relying on some other monitoring endpoint just extends the possible points of failure. What do you do, if the monitoring system fails to respond?
  • kk99
    Options
    @Markus

    is this then one to count the failed connects?

    public virtual void OnFailedToConnectToPhoton(DisconnectCause cause)
    {
    Debug.LogError("Cause: " + cause);

    }

    or is there another Exception called?
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    That callback should be enough, you can always wrap connect calls using try catch block.
  • kk99
    Options
    alright. thanks for the suggestions. it's time to implement this plan B