Always EU region?

I am passing RegionSelectionMode::DEFAULT parameter when creating the LoadBalancing Client, so I suppose it should select the best available region, but I always see the EU region selected in connectReturn callback, regardless of the player's position (checked US, Australia, Thailand, Russia).

onAvailableRegions callback is not called.

How it is possible to check why EU is always selected?

Comments

  • KaiserludiKaiserludi admin
    edited September 2020
    Hi @ufnv.

    This is by design.

    RegionSelectionMode::DEFAULT makes the Client always connect to the first entry in the list of available regions, which on the public Cloud usually is region 'eu', except when you have set-up a region-whitelist in you dashboard, that does not contain that region.

    As you can read in the API-reference at https://doc-api.photonengine.com/en/cpp/current/a05522.html#a880c327774ab3184e50570a601739eef, the onAvailableRegions() callback will only be called for RegionSelectionMode::SELECT.

    If you want your code to select a region yourself, then you should use RegionSelectionMode::SELECT.
    demo_loadbalancing contains an example implementation for Listener::onAvailableRegions().

    If you want the Photon Client to automatically ping all available regions and select the one with the lowest average ping-result for you, then you should use RegionSelectionMode::BEST.

    As pinging takes a moment, it is recommend to not pass RegionSelectionMode::BEST every time you construct a Client instance, but to cache the the region with the best ping and use it with RegionSelectionMode::SELECT on subsequent connects once you have acquired the region with the best ping.
    See the API-reference for getRegionWithBestPing() https://doc-api.photonengine.com/en/cpp/current/a05522.html#a91ccef9856816076a0affd88619319e0 for details.
  • Thanks! I was under impression that DEFAULT automatically means BEST.

    I already use SELECT to find games in all available regions, so BEST is only used when creating a new "Server" game.
Sign In or Register to comment.