Quantum 3 3.1.0

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

Settings for Photon application(s) and the server to connect to. More...

Public Member Functions

 AppSettings ()
 Creates an AppSettings instance with default values. More...
 
 AppSettings (AppSettings original=null)
 Initializes the AppSettings with default values or the provided original. More...
 
ClientAppType ClientTypeDetect ()
 Tries to detect the ClientAppType, based on which AppId values are present. Can detect Realtime, Fusion or Quantum. Used when the RealtimeClient.ClientType is set to detect. More...
 
AppSettings CopyTo (AppSettings target)
 Copies values of this instance to the target. More...
 
string GetAppId (ClientAppType ct)
 Gets the AppId for a specific type of client. More...
 
string ToStringFull ()
 ToString but with more details. More...
 

Static Public Member Functions

static bool IsAppId (string val)
 Checks if a string is a Guid by attempting to create one. More...
 

Public Attributes

string AppIdChat
 AppId for Photon Chat. More...
 
string AppIdFusion
 AppId for Photon Fusion. More...
 
string AppIdQuantum
 AppId for Photon Quantum. More...
 
string AppIdRealtime
 AppId for Realtime or PUN. More...
 
string AppIdVideo
 AppId for Photon Video. More...
 
string AppIdVoice
 AppId for Photon Voice. More...
 
string AppVersion
 The AppVersion can be used to identify builds and will split the AppId distinct "Virtual AppIds" (important for matchmaking). More...
 
AuthModeOption AuthMode = AuthModeOption.AuthOnceWss
 Defines how authentication is done. On each system, once or once via a WSS connection (safe). More...
 
string BestRegionSummaryFromStorage
 Set to a previous BestRegionSummary value before connecting. More...
 
LogLevel ClientLogging = LogLevel.Warning
 Log level for the RealtimeClient and callbacks. Useful to get info about the client state, servers it uses and operations called. More...
 
bool EnableLobbyStatistics
 If true, the Master Server will send statistics for currently used lobbies. Defaults to false. More...
 
bool EnableProtocolFallback = true
 Enables the fallback to WSS, should the initial connect to the Name Server fail. Some exceptions apply. More...
 
string FixedRegion
 Can be set to any of the Photon Cloud's region names to directly connect to that region. More...
 
LogLevel NetworkLogging = LogLevel.Error
 Log level for the PhotonPeer and connection. Useful to debug connection related issues. More...
 
ushort Port
 If not null, this sets the port of the first Photon server to connect to (that will "forward" the client as needed). More...
 
ConnectionProtocol Protocol = ConnectionProtocol.Udp
 The network level protocol to use. More...
 
string ProxyServer
 Defines a proxy URL for WebSocket connections. Can be the proxy or point to a .pac file. More...
 
string Server
 The address (hostname or IP) of the server to connect to. More...
 
bool UseNameServer = true
 If false, the app will attempt to connect to a Master Server (which is obsolete but sometimes still necessary). More...
 

Properties

string? AppIdVoiceOrVideo [get]
 Gets either the AppIdVoice or the AppIdVideo for convenient use in either SDK. More...
 
bool IsBestRegion [get]
 If true, the client should fetch the region list from the Name Server and find the one with best ping. More...
 
bool IsDefaultNameServer [get]
 If true, the default nameserver address for the Photon Cloud should be used. More...
 
bool IsDefaultPort [get]
 If true, the default ports for a protocol will be used. More...
 
bool IsMasterServerAddress [get]
 If true, the Server field contains a Master Server address (if any address at all). More...
 

Detailed Description

Settings for Photon application(s) and the server to connect to.

This is Serializable for Unity, so it can be included in ScriptableObject instances.

Constructor & Destructor Documentation

◆ AppSettings() [1/2]

Photon.Realtime.AppSettings.AppSettings ( )
inline

Creates an AppSettings instance with default values.

◆ AppSettings() [2/2]

Photon.Realtime.AppSettings.AppSettings ( AppSettings  original = null)
inline

Initializes the AppSettings with default values or the provided original.

Parameters
originalIf non-null, all values are copied from the original.

Member Function Documentation

◆ GetAppId()

string Photon.Realtime.AppSettings.GetAppId ( ClientAppType  ct)
inline

Gets the AppId for a specific type of client.

Components that can work for the Voice SDK or the Video SDK can use ClientAppType.VoiceOrVideo. It returns AppIdVoiceOrVideo.

◆ ClientTypeDetect()

ClientAppType Photon.Realtime.AppSettings.ClientTypeDetect ( )
inline

Tries to detect the ClientAppType, based on which AppId values are present. Can detect Realtime, Fusion or Quantum. Used when the RealtimeClient.ClientType is set to detect.

Returns
Most likely to be used ClientAppType or ClientAppType.Detect in conflicts.

◆ ToStringFull()

string Photon.Realtime.AppSettings.ToStringFull ( )
inline

ToString but with more details.

◆ IsAppId()

static bool Photon.Realtime.AppSettings.IsAppId ( string  val)
inlinestatic

Checks if a string is a Guid by attempting to create one.

Parameters
valThe potential guid to check.
Returns
True if new Guid(val) did not fail.

◆ CopyTo()

AppSettings Photon.Realtime.AppSettings.CopyTo ( AppSettings  target)
inline

Copies values of this instance to the target.

Parameters
targetTarget instance.
Returns
The target.

Member Data Documentation

◆ AppIdRealtime

string Photon.Realtime.AppSettings.AppIdRealtime

AppId for Realtime or PUN.

◆ AppIdFusion

string Photon.Realtime.AppSettings.AppIdFusion

AppId for Photon Fusion.

◆ AppIdQuantum

string Photon.Realtime.AppSettings.AppIdQuantum

AppId for Photon Quantum.

◆ AppIdChat

string Photon.Realtime.AppSettings.AppIdChat

AppId for Photon Chat.

◆ AppIdVoice

string Photon.Realtime.AppSettings.AppIdVoice

AppId for Photon Voice.

◆ AppIdVideo

string Photon.Realtime.AppSettings.AppIdVideo

AppId for Photon Video.

Photon Video is a separate SDK and AppId-type. Components that work for Voice and Video alike can use AppIdVoiceOrVideo.

◆ AppVersion

string Photon.Realtime.AppSettings.AppVersion

The AppVersion can be used to identify builds and will split the AppId distinct "Virtual AppIds" (important for matchmaking).

◆ UseNameServer

bool Photon.Realtime.AppSettings.UseNameServer = true

If false, the app will attempt to connect to a Master Server (which is obsolete but sometimes still necessary).

if true, Server points to a NameServer (or is null, using the default), else it points to a MasterServer.

◆ FixedRegion

string Photon.Realtime.AppSettings.FixedRegion

Can be set to any of the Photon Cloud's region names to directly connect to that region.

if this IsNullOrEmpty() AND UseNameServer == true, use BestRegion. else, use a server

◆ BestRegionSummaryFromStorage

string Photon.Realtime.AppSettings.BestRegionSummaryFromStorage

Set to a previous BestRegionSummary value before connecting.

This is a value used when the client connects to the "Best Region".
If this is null or empty, all regions gets pinged. Providing a previous summary on connect, speeds up best region selection and makes the previously selected region "sticky".

Unity clients should store the BestRegionSummary in the PlayerPrefs. You can store the new result by implementing IConnectionCallbacks.OnConnectedToMaster. If RealtimeClient.SummaryToCache is not null, store this string. To avoid storing the value multiple times, you could set SummaryToCache to null.

◆ Server

string Photon.Realtime.AppSettings.Server

The address (hostname or IP) of the server to connect to.

◆ Port

ushort Photon.Realtime.AppSettings.Port

If not null, this sets the port of the first Photon server to connect to (that will "forward" the client as needed).

◆ ProxyServer

string Photon.Realtime.AppSettings.ProxyServer

Defines a proxy URL for WebSocket connections. Can be the proxy or point to a .pac file.

This URL supports various definitions:

"user:pass@proxyaddress:port"
"proxyaddress:port"
"system:"
"pac:"
"pac:http://host/path/pacfile.pac"

Important: Don't define a protocol, except to point to a pac file. The proxy address should not begin with http:// or https://.

◆ Protocol

ConnectionProtocol Photon.Realtime.AppSettings.Protocol = ConnectionProtocol.Udp

The network level protocol to use.

◆ EnableProtocolFallback

bool Photon.Realtime.AppSettings.EnableProtocolFallback = true

Enables the fallback to WSS, should the initial connect to the Name Server fail. Some exceptions apply.

For security reasons, a fallback to another protocol is not done when using WSS or AuthMode.AuthOnceWss. That would compromise the expected security.

If the fallback is impossible or if that connection also fails, the app logic must handle the case. It might even make sense to just try the same connection settings once more (or ask the user to do something about the network connectivity, firewalls, etc).

The fallback will use the default Name Server port as defined by ProtocolToNameServerPort.

◆ AuthMode

AuthModeOption Photon.Realtime.AppSettings.AuthMode = AuthModeOption.AuthOnceWss

Defines how authentication is done. On each system, once or once via a WSS connection (safe).

◆ EnableLobbyStatistics

bool Photon.Realtime.AppSettings.EnableLobbyStatistics

If true, the Master Server will send statistics for currently used lobbies. Defaults to false.

The lobby statistics can be useful if your title dynamically uses lobbies, depending (e.g.) on current player activity or such. The provided list of stats is capped to 500.

Changing the value while being connected has no immediate effect. Set this before connecting.

Implement ILobbyCallbacks.OnLobbyStatisticsUpdate to get the list of used lobbies.

◆ NetworkLogging

LogLevel Photon.Realtime.AppSettings.NetworkLogging = LogLevel.Error

Log level for the PhotonPeer and connection. Useful to debug connection related issues.

◆ ClientLogging

LogLevel Photon.Realtime.AppSettings.ClientLogging = LogLevel.Warning

Log level for the RealtimeClient and callbacks. Useful to get info about the client state, servers it uses and operations called.

Property Documentation

◆ AppIdVoiceOrVideo

string? Photon.Realtime.AppSettings.AppIdVoiceOrVideo
get

Gets either the AppIdVoice or the AppIdVideo for convenient use in either SDK.

If the Video SDK is enabled, AppIdVideo is preferred. If that is empty, AppIdVoice is returned.

◆ IsMasterServerAddress

bool Photon.Realtime.AppSettings.IsMasterServerAddress
get

If true, the Server field contains a Master Server address (if any address at all).

◆ IsBestRegion

bool Photon.Realtime.AppSettings.IsBestRegion
get

If true, the client should fetch the region list from the Name Server and find the one with best ping.

See "Best Region" in the online docs.

◆ IsDefaultNameServer

bool Photon.Realtime.AppSettings.IsDefaultNameServer
get

If true, the default nameserver address for the Photon Cloud should be used.

◆ IsDefaultPort

bool Photon.Realtime.AppSettings.IsDefaultPort
get

If true, the default ports for a protocol will be used.