Photon .NET Client API 4.1.4.8

Public Member Functions | Static Public Attributes | Properties | List of all members
Photon.Realtime.RegionHandler Class Reference

Provides methods to work with Photon's regions (Photon Cloud) and can be use to find the one with best ping. More...

Public Member Functions

string GetResults ()
 
void SetRegions (OperationResponse opGetRegions)
 
bool PingMinimumOfRegions (Action< RegionHandler > onCompleteCallback, string previousSummary)
 

Static Public Attributes

static Type PingImplementation
 The implementation of PhotonPing to use for region pinging (Best Region detection). More...
 

Properties

List< RegionEnabledRegions [get, set]
 A list of region names for the Photon Cloud. Set by the result of OpGetRegions(). More...
 
Region BestRegion [get]
 When PingMinimumOfRegions was called and completed, the BestRegion is identified by best ping. More...
 
string SummaryToCache [get]
 This value summarizes the results of pinging currently available regions (after PingMinimumOfRegions finished). More...
 
bool IsPinging [get]
 

Detailed Description

Provides methods to work with Photon's regions (Photon Cloud) and can be use to find the one with best ping.

When a client uses a Name Server to fetch the list of available regions, the LoadBalancingClient will create a RegionHandler and provide it via the OnRegionListReceived callback.

Your logic can decide to either connect to one of those regional servers, or it may use PingMinimumOfRegions to test which region provides the best ping.

It makes sense to make clients "sticky" to a region when one gets selected. This can be achieved by storing the SummaryToCache value, once pinging was done. When the client connects again, the previous SummaryToCache helps limiting the number of regions to ping. In best case, only the previously selected region gets re-pinged and if the current ping is not much worse, this one region is used again.

Member Function Documentation

◆ GetResults()

string Photon.Realtime.RegionHandler.GetResults ( )
inline

◆ PingMinimumOfRegions()

bool Photon.Realtime.RegionHandler.PingMinimumOfRegions ( Action< RegionHandler onCompleteCallback,
string  previousSummary 
)
inline

◆ SetRegions()

void Photon.Realtime.RegionHandler.SetRegions ( OperationResponse  opGetRegions)
inline

Member Data Documentation

◆ PingImplementation

Type Photon.Realtime.RegionHandler.PingImplementation
static

The implementation of PhotonPing to use for region pinging (Best Region detection).

Defaults to null, which means the Type is set automatically.

Property Documentation

◆ BestRegion

Region Photon.Realtime.RegionHandler.BestRegion
get

When PingMinimumOfRegions was called and completed, the BestRegion is identified by best ping.

◆ EnabledRegions

List<Region> Photon.Realtime.RegionHandler.EnabledRegions
getset

A list of region names for the Photon Cloud. Set by the result of OpGetRegions().

Implement ILoadBalancingCallbacks and register for the callbacks to get OnRegionListReceived(RegionHandler regionHandler). You can also put a "case OperationCode.GetRegions:" into your OnOperationResponse method to notice when the result is available.

◆ IsPinging

bool Photon.Realtime.RegionHandler.IsPinging
get

◆ SummaryToCache

string Photon.Realtime.RegionHandler.SummaryToCache
get

This value summarizes the results of pinging currently available regions (after PingMinimumOfRegions finished).

This value should be stored in the client by the game logic. When connecting again, use it as previous summary to speed up pinging regions and to make the best region sticky for the client.


The documentation for this class was generated from the following file: