Photon Server API Documentation v5.0RC1

Public Member Functions | Public Attributes | Protected Member Functions | Properties | List of all members
Photon.LoadBalancing.MasterServer.MasterApplication Class Reference
Inheritance diagram for Photon.LoadBalancing.MasterServer.MasterApplication:
Photon.SocketServer.ApplicationBase

Public Member Functions

 MasterApplication ()
 
CustomTypeCache GetS2SCustomTypeCache ()
 
virtual void OnServerWentOffline (GameServerContext gameServerContext)
 
- Public Member Functions inherited from Photon.SocketServer.ApplicationBase
void BroadCastEvent< TPeer > (IEventData eventData, IEnumerable< TPeer > peers, SendParameters sendParameters)
 Sends an event to a list of peers. This method serializes the data just once per protocol instead of once per peer. More...
 
bool ConnectToServerTcp (IPEndPoint remoteEndPoint, string applicationName, object state)
 Establishes a TCP connection between two Photon instances. CreateServerPeer is called once the connection is established. OnServerConnectionFailed is called if the connection fails.
More...
 
bool ConnectToServerTcp (IPEndPoint remoteEndPoint, string applicationName, object state, IRpcProtocol protocol)
 Establishes a TCP connection between two Photon instances. CreateServerPeer is called once the connection is established. OnServerConnectionFailed is called if the connection fails.
More...
 
bool ConnectToServerMuxTcp (IPEndPoint remoteEndPoint, string applicationName, object state)
 Establishes a logical, multiplexed TCP connection between two Photon instances. Multiple logical connections are sharing a single physical connection. CreateServerPeer is called once a logical connection is established. OnServerConnectionFailed is called if the logical connection fails. If a phyiscal connection exists when ConnectToServerMuxTcp is called, it is used; otherwise a physical connection is established. If the physical connection is aborted, all logical connections are aborted as well. More...
 
bool ConnectToServerUdp (IPEndPoint remoteEndPoint, string applicationName, object state, byte numChannels, short? mtu, Version clientVersion=null)
 Establishes an UDP connection between two Photon instances. CreateServerPeer is called once the connection is established. OnServerConnectionFailed is called if the connection fails. More...
 
bool ConnectToServerWebSocketHixie76 (IPEndPoint remoteEndPoint, string applicationName, object state, string origin)
 Establishes an WebSocket connection between two Photon instances, using the Hixie76 WebSocket protocol. CreateServerPeer is called once the connection is established. OnServerConnectionFailed is called if the connection fails. More...
 
bool ConnectToServerWebSocket (IPEndPoint remoteEndPoint, string applicationName, object state, WebSocketVersion webSocketVersion, IRpcProtocol protocol)
 Establishes an WebSocket connection between two Photon instances. CreateServerPeer is called once the connection is established. OnServerConnectionFailed is called if the connection fails. More...
 
bool ConnectToServerWebRTC (IPEndPoint remoteEndPoint, string applicationName, object state, IRpcProtocol protocol)
 
bool ConnectToServer (IPEndPoint remoteEndPoint, string applicationName, object state)
 This method overload is obsolete; use ConnectToServerTcp. More...
 
bool ConnectToServer (IPEndPoint remoteEndPoint, bool useMux, string applicationName, object state)
 This method overload is obsolete; use ConnectToServerMuxTcp. More...
 
bool ConnectToServer (IPEndPoint remoteEndPoint, string applicationName, object state, IRpcProtocol protocol)
 This method overload is obsolete; use ConnectToServerTcp. More...
 
bool ConnectToServer (IPEndPoint remoteEndPoint, string applicationName, object state, byte numChannels, short? mtu, Version clientVersion=null)
 This method overload is obsolete; use ConnectToServerUdp. More...
 
void BroadcastMessage< TPeer > (object message, IEnumerable< TPeer > peers, SendParameters sendParameters)
 
string[] ListenerList (out ListenerStatus[] status)
 
bool ListenerStart (string name)
 
bool ListenerStop (string name)
 
bool AddRestRequestHandler (string path, RestRequestHandler handler)
 
bool RemoveRestRequestHandler (string path)
 
void InitCorePerformanceCounters ()
 
void OnWebRTCConnectionEstablished (IPhotonWebRTCPeer peer, byte maxChannelCount, uint flags)
 
void OnWebRTCChannelConnected (IPhotonWebRTCPeer peer, object userData, byte channelId, ChannelType ChannelType, bool unordered, ushort priority, uint reliability, string label, string protocol)
 
virtual void OnWebRTCChannelDestroyed (IPhotonWebRTCPeer peer, object userData, byte channelId)
 
void OnOutboundWebRTCConnectionEstablished (IPhotonWebRTCPeer peer, object userData, byte maxChannelCount, uint flags)
 
void OnOutboundWebRTCConnectionFailed (object userData, uint errorCode)
 
IPhotonApplication OnStart (string instanceName, string applicationName, IPhotonApplicationSink sink, IControlListeners listenerControl, ILogToUnmanagedLog unmanagedLog, IPhotonApplicationsCounter applicationsCounter, string unmanagedLogDirectory)
 Called when the application is started. This method calls Setup. More...
 

Public Attributes

bool IsMaster => true
 

Protected Member Functions

 MasterApplication (IConfiguration configuration)
 
override PeerBase CreatePeer (InitRequest initRequest)
 This method is called by the IPhotonApplication.OnInit implementation of this class. The inheritor should return a PeerBase implementation. More...
 
PeerBase CreateGameServerPeer (InitRequest initRequest)
 
virtual IncomingGameServerPeer CreateMasterServerPeer (InitRequest initRequest)
 
virtual void Initialize ()
 method to initialize self-hosted specific stuff More...
 
virtual bool IsGameServerPeer (InitRequest initRequest)
 
override void OnStopRequested ()
 Called when photon stops application domain More...
 
virtual AuthTokenFactory GetAuthTokenFactory ()
 
override void Setup ()
 This method is called when the current application has been started. The inheritor can setup log4net here and execute other initialization routines here. More...
 
virtual void InitLogging ()
 
override void TearDown ()
 This method is called when the current application is being stopped. The inheritor can execute cleanup routines here. More...
 
virtual void RemoveGameServerFromLobby (GameServerContext gameServerContext)
 
- Protected Member Functions inherited from Photon.SocketServer.ApplicationBase
 ApplicationBase (IConfiguration configuration)
 Initializes a new instance of the ApplicationBase class. More...
 
virtual IFiber CreatePeerFiber (InitRequest request)
 
virtual object DecryptAuthToken (InitRequest initRequest, byte[] authToken, int offset, int length, out Dictionary< byte, object > encryptionData, out string errorMsg)
 
virtual void OnServerConnectionFailed (int errorCode, string errorMessage, object state)
 Invoked if a connection attempt to a server fails. More...
 

Properties

static ApplicationStats AppStats [get, protected set]
 
GameServerContextManager GameServers [get, protected set]
 
LoadBalancer< GameServerContextLoadBalancer [get, protected set]
 
GameApplication DefaultApplication [get, protected set]
 
AuthTokenFactory TokenCreator [get, protected set]
 
CustomAuthHandler CustomAuthHandler [get, protected set]
 
- Properties inherited from Photon.SocketServer.ApplicationBase
IConfiguration Configuration [get, protected set]
 Configuration loaded by descendants More...
 
static ApplicationBase Instance [get]
 Gets the application instance. More...
 
string ApplicationName [get]
 Gets the application name set in PhotonServer.config. More...
 
string ApplicationPath [get]
 Gets the application path set in PhotonServer.config. More...
 
string ApplicationRootPath [get]
 Gets the path of the application root path - base location of all applications. More...
 
string BinaryPath [get]
 Gets the path of the application binaries. More...
 
int PeerCount [get]
 Gets the number of peers currently connected to the application. More...
 
string PhotonInstanceName [get]
 Gets the name of the photon instance. More...
 
bool Running [get]
 Gets a value indicating whether the application is running (the time between Setup and OnStopRequested). More...
 
string HwId [get]
 
string UnmanagedLogPath [get]
 Gets the log path of Photon. More...
 
Version CoreVersion [get]
 Gets Photon Native Core version (PhotonSocketServer.exe). More...
 
Version SdkVersion [get]
 Gets Photon Managed Core version (SDK). More...
 
int EncrptionQueueLimit [get, set]
 
bool UseEncryptionQueue [get, set]
 

Additional Inherited Members

- Static Public Member Functions inherited from Photon.SocketServer.ApplicationBase
static T GetConfigSectionAndValidate< T > (string path)
 

Constructor & Destructor Documentation

◆ MasterApplication() [1/2]

Photon.LoadBalancing.MasterServer.MasterApplication.MasterApplication ( )
inline

◆ MasterApplication() [2/2]

Photon.LoadBalancing.MasterServer.MasterApplication.MasterApplication ( IConfiguration  configuration)
inlineprotected

Member Function Documentation

◆ CreateGameServerPeer()

PeerBase Photon.LoadBalancing.MasterServer.MasterApplication.CreateGameServerPeer ( InitRequest  initRequest)
inlineprotected

◆ CreateMasterServerPeer()

virtual IncomingGameServerPeer Photon.LoadBalancing.MasterServer.MasterApplication.CreateMasterServerPeer ( InitRequest  initRequest)
inlineprotectedvirtual

◆ CreatePeer()

override PeerBase Photon.LoadBalancing.MasterServer.MasterApplication.CreatePeer ( InitRequest  initRequest)
inlineprotectedvirtual

This method is called by the IPhotonApplication.OnInit implementation of this class. The inheritor should return a PeerBase implementation.

Parameters
initRequestThe initialization request.
Returns
A new instance of PeerBase or null.

Implements Photon.SocketServer.ApplicationBase.

◆ GetAuthTokenFactory()

virtual AuthTokenFactory Photon.LoadBalancing.MasterServer.MasterApplication.GetAuthTokenFactory ( )
inlineprotectedvirtual

◆ GetS2SCustomTypeCache()

CustomTypeCache Photon.LoadBalancing.MasterServer.MasterApplication.GetS2SCustomTypeCache ( )
inline

◆ Initialize()

virtual void Photon.LoadBalancing.MasterServer.MasterApplication.Initialize ( )
inlineprotectedvirtual

method to initialize self-hosted specific stuff

◆ InitLogging()

virtual void Photon.LoadBalancing.MasterServer.MasterApplication.InitLogging ( )
inlineprotectedvirtual

◆ IsGameServerPeer()

virtual bool Photon.LoadBalancing.MasterServer.MasterApplication.IsGameServerPeer ( InitRequest  initRequest)
inlineprotectedvirtual

◆ OnServerWentOffline()

virtual void Photon.LoadBalancing.MasterServer.MasterApplication.OnServerWentOffline ( GameServerContext  gameServerContext)
inlinevirtual

◆ OnStopRequested()

override void Photon.LoadBalancing.MasterServer.MasterApplication.OnStopRequested ( )
inlineprotectedvirtual

Called when photon stops application domain

Reimplemented from Photon.SocketServer.ApplicationBase.

◆ RemoveGameServerFromLobby()

virtual void Photon.LoadBalancing.MasterServer.MasterApplication.RemoveGameServerFromLobby ( GameServerContext  gameServerContext)
inlineprotectedvirtual

◆ Setup()

override void Photon.LoadBalancing.MasterServer.MasterApplication.Setup ( )
inlineprotectedvirtual

This method is called when the current application has been started. The inheritor can setup log4net here and execute other initialization routines here.

log4net initialization:

private static readonly ILogger log = LogManager.GetCurrentClassLogger();
protected override void Setup()
{
// configure log4net with a config file
var configFileInfo = new FileInfo(Path.Combine(this.BinaryPath, "log4net.config"));
XmlConfigurator.ConfigureAndWatch(configFileInfo);
// redirect photon sdk internal logging to log4net
}

Implements Photon.SocketServer.ApplicationBase.

◆ TearDown()

override void Photon.LoadBalancing.MasterServer.MasterApplication.TearDown ( )
inlineprotectedvirtual

This method is called when the current application is being stopped. The inheritor can execute cleanup routines here.

Implements Photon.SocketServer.ApplicationBase.

Member Data Documentation

◆ IsMaster

bool Photon.LoadBalancing.MasterServer.MasterApplication.IsMaster => true

Property Documentation

◆ AppStats

ApplicationStats Photon.LoadBalancing.MasterServer.MasterApplication.AppStats
staticgetprotected set

◆ CustomAuthHandler

CustomAuthHandler Photon.LoadBalancing.MasterServer.MasterApplication.CustomAuthHandler
getprotected set

◆ DefaultApplication

GameApplication Photon.LoadBalancing.MasterServer.MasterApplication.DefaultApplication
getprotected set

◆ GameServers

GameServerContextManager Photon.LoadBalancing.MasterServer.MasterApplication.GameServers
getprotected set

◆ LoadBalancer

LoadBalancer<GameServerContext> Photon.LoadBalancing.MasterServer.MasterApplication.LoadBalancer
getprotected set

◆ TokenCreator

AuthTokenFactory Photon.LoadBalancing.MasterServer.MasterApplication.TokenCreator
getprotected set
ExitGames.Logging
Definition: ILogger.cs:10
Photon.LoadBalancing.MasterServer.MasterApplication.Setup
override void Setup()
This method is called when the current application has been started. The inheritor can setup log4net ...
Definition: MasterApplication.cs:254
ExitGames.Logging.LogManager.SetLoggerFactory
static void SetLoggerFactory(ILoggerFactory factory)
Assigns a new ILoggerFactory to create ILogger instances.
Definition: LogManager.cs:110
ExitGames.Logging.Log4Net
Definition: Log4NetLogger.cs:10
ExitGames.Logging.LogManager
The log manager provides methods to get instances of ILogger using a ILoggerFactory....
Definition: LogManager.cs:25
ExitGames.Logging.Log4Net.ILogger
ILogger ILogger
Definition: Log4NetLogger.cs:16
ExitGames.Logging.Log4Net.Log4NetLoggerFactory.Instance
static readonly Log4NetLoggerFactory Instance
The singleton.
Definition: Log4NetLoggerFactory.cs:25
ExitGames
Definition: BaseSubscription.cs:1
ExitGames.Logging.Log4Net.Log4NetLoggerFactory
This ILoggerFactory creates ILogger that log to the log4net framework.
Definition: Log4NetLoggerFactory.cs:20