Photon Server API

Public Member Functions | Protected Member Functions | Properties | List of all members
Photon.LoadBalancing.GameServer.GameApplication Class Reference
Inheritance diagram for Photon.LoadBalancing.GameServer.GameApplication:
Photon.SocketServer.ApplicationBase Photon.LoadBalancing.UnitTests.UnifiedServer.OfflineExtra.TestApplication

Public Member Functions

 GameApplication ()
 
byte GetCurrentNodeId ()
 
void OnMasterConnectionEstablished (MasterServerConnectionBase masterServerConnectionBase)
 
CustomTypeCache GetS2SCustomTypeCache ()
 
void UpdateMasterEndPoint ()
 
- 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)
 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 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)
 This method overload is obsolete; use ConnectToServerUdp. More...
 
string[] ListenerList (out ListenerStatus[] status)
 
bool ListenerStart (string name)
 
bool ListenerStop (string name)
 
void OnWebRTCConnectionEstablished (IPhotonWebRTCPeer peer, byte maxChannelCount, uint flags)
 
void OnOutboundWebRTCConnectionEstablished (IPhotonWebRTCPeer peer, object userData, byte maxChannelCount, uint flags)
 
void OnOutboundWebRTCConnectionFailed (object userData, uint errorCode)
 
void OnWebRTCChannelConnected (IPhotonWebRTCPeer peer, object userData, byte channelId, ChannelType ChannelType, bool unordered, ushort priority, uint reliability, string label, string protocol)
 
void OnWebRTCChannelDestroyed (IPhotonWebRTCPeer peer, object userData, byte channelId)
 
IPhotonApplication OnStart (string instanceName, string applicationName, IPhotonApplicationSink sink, IControlListeners controlListners, PhotonHostRuntimeInterfaces.ILogToUnmanagedLog unmanagedLog, IPhotonApplicationsCounter applicationsCounter, string unmanagedLogDirectory)
 Called when the application is started. This method calls Setup. More...
 
override System.Runtime.Remoting.ObjRef CreateObjRef (Type requestedType)
 
new object GetLifetimeService ()
 
override object InitializeLifetimeService ()
 

Protected Member Functions

virtual void CheckGames ()
 Sanity check to verify that game states are cleaned up correctly More...
 
virtual PeerBase CreateGamePeer (InitRequest initRequest)
 
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...
 
virtual void InitLogging ()
 
override void OnServerConnectionFailed (int errorCode, string errorMessage, object state)
 Invoked if a connection attempt to a server fails. More...
 
override void OnStopRequested ()
 Called when photon starts a new app domain for the same application. New connections will connect to the new app domain. This app domain continues to receive operations until from existing connections until the last peer disconnects. More...
 
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...
 
void SetupServerStateMonitor ()
 
virtual void SetupMasterConnection ()
 
void SetupFeedbackControlSystem ()
 
override void TearDown ()
 This method is called when the current application is being stopped. The inheritor can execute cleanup routines here. More...
 
virtual void OnNewServerState (ServerState oldState, ServerState requestedState, TimeSpan offlineTime)
 
virtual void RaiseOfflineEvent (TimeSpan time)
 
- Protected Member Functions inherited from Photon.SocketServer.ApplicationBase
 ApplicationBase ()
 Initializes a new instance of the ApplicationBase class. More...
 
virtual IFiber CreatePeerFiber (InitRequest request)
 
new MarshalByRefObject MemberwiseClone (bool cloneIdentity)
 

Properties

Guid ServerId [get]
 
int? GamingTcpPort [get, protected set]
 
int? GamingUdpPort [get, protected set]
 
int? GamingWebSocketPort [get, protected set]
 
int? GamingSecureWebSocketPort [get, set]
 
int? GamingHttpPort [get, protected set]
 
int? GamingHttpsPort [get, protected set]
 
string GamingHttpPath [get, protected set]
 
IPEndPoint MasterEndPoint [get, protected set]
 
ApplicationStatsPublisher AppStatsPublisher [get, protected set]
 
MasterServerConnection MasterServerConnection [get]
 
IPAddress PublicIpAddress [get, protected set]
 
IPAddress PublicIpAddressIPv6 [get, protected set]
 
WorkloadController WorkloadController [get, protected set]
 
virtual GameCache GameCache [get, protected set]
 
AuthTokenFactory TokenCreator [get, protected set]
 
S2SCustomTypeCacheMan S2SCacheMan [get, protected set]
 
int ConnectRetryIntervalSeconds [get, set]
 
bool IsMaster [get, set]
 
- Properties inherited from Photon.SocketServer.ApplicationBase
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...
 

Constructor & Destructor Documentation

◆ GameApplication()

Photon.LoadBalancing.GameServer.GameApplication.GameApplication ( )
inline

Member Function Documentation

◆ CheckGames()

virtual void Photon.LoadBalancing.GameServer.GameApplication.CheckGames ( )
inlineprotectedvirtual

Sanity check to verify that game states are cleaned up correctly

◆ CreateGamePeer()

virtual PeerBase Photon.LoadBalancing.GameServer.GameApplication.CreateGamePeer ( InitRequest  initRequest)
inlineprotectedvirtual

◆ CreatePeer()

override PeerBase Photon.LoadBalancing.GameServer.GameApplication.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.

◆ GetCurrentNodeId()

byte Photon.LoadBalancing.GameServer.GameApplication.GetCurrentNodeId ( )
inline

◆ GetS2SCustomTypeCache()

CustomTypeCache Photon.LoadBalancing.GameServer.GameApplication.GetS2SCustomTypeCache ( )
inline

◆ InitLogging()

virtual void Photon.LoadBalancing.GameServer.GameApplication.InitLogging ( )
inlineprotectedvirtual

◆ OnMasterConnectionEstablished()

void Photon.LoadBalancing.GameServer.GameApplication.OnMasterConnectionEstablished ( MasterServerConnectionBase  masterServerConnectionBase)
inline

◆ OnNewServerState()

virtual void Photon.LoadBalancing.GameServer.GameApplication.OnNewServerState ( ServerState  oldState,
ServerState  requestedState,
TimeSpan  offlineTime 
)
inlineprotectedvirtual

◆ OnServerConnectionFailed()

override void Photon.LoadBalancing.GameServer.GameApplication.OnServerConnectionFailed ( int  errorCode,
string  errorMessage,
object  state 
)
inlineprotectedvirtual

Invoked if a connection attempt to a server fails.

Parameters
errorCodeThe error code.
errorMessageThe error message.
stateThe state.

Reimplemented from Photon.SocketServer.ApplicationBase.

◆ OnStopRequested()

override void Photon.LoadBalancing.GameServer.GameApplication.OnStopRequested ( )
inlineprotectedvirtual

Called when photon starts a new app domain for the same application. New connections will connect to the new app domain. This app domain continues to receive operations until from existing connections until the last peer disconnects.

This feature requires the AutoRestart setting in the PhotonServer.config. Please refer to the configuration manual for more details.

Reimplemented from Photon.SocketServer.ApplicationBase.

◆ RaiseOfflineEvent()

virtual void Photon.LoadBalancing.GameServer.GameApplication.RaiseOfflineEvent ( TimeSpan  time)
inlineprotectedvirtual

◆ Setup()

override void Photon.LoadBalancing.GameServer.GameApplication.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.

Reimplemented in Photon.LoadBalancing.UnitTests.UnifiedServer.OfflineExtra.TestApplication.

◆ SetupFeedbackControlSystem()

void Photon.LoadBalancing.GameServer.GameApplication.SetupFeedbackControlSystem ( )
inlineprotected

◆ SetupMasterConnection()

virtual void Photon.LoadBalancing.GameServer.GameApplication.SetupMasterConnection ( )
inlineprotectedvirtual

◆ SetupServerStateMonitor()

void Photon.LoadBalancing.GameServer.GameApplication.SetupServerStateMonitor ( )
inlineprotected

◆ TearDown()

override void Photon.LoadBalancing.GameServer.GameApplication.TearDown ( )
inlineprotectedvirtual

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

Implements Photon.SocketServer.ApplicationBase.

◆ UpdateMasterEndPoint()

void Photon.LoadBalancing.GameServer.GameApplication.UpdateMasterEndPoint ( )
inline

Property Documentation

◆ AppStatsPublisher

ApplicationStatsPublisher Photon.LoadBalancing.GameServer.GameApplication.AppStatsPublisher
getprotected set

◆ ConnectRetryIntervalSeconds

int Photon.LoadBalancing.GameServer.GameApplication.ConnectRetryIntervalSeconds
getset

◆ GameCache

virtual GameCache Photon.LoadBalancing.GameServer.GameApplication.GameCache
getprotected set

◆ GamingHttpPath

string Photon.LoadBalancing.GameServer.GameApplication.GamingHttpPath
getprotected set

◆ GamingHttpPort

int? Photon.LoadBalancing.GameServer.GameApplication.GamingHttpPort
getprotected set

◆ GamingHttpsPort

int? Photon.LoadBalancing.GameServer.GameApplication.GamingHttpsPort
getprotected set

◆ GamingSecureWebSocketPort

int? Photon.LoadBalancing.GameServer.GameApplication.GamingSecureWebSocketPort
getset

◆ GamingTcpPort

int? Photon.LoadBalancing.GameServer.GameApplication.GamingTcpPort
getprotected set

◆ GamingUdpPort

int? Photon.LoadBalancing.GameServer.GameApplication.GamingUdpPort
getprotected set

◆ GamingWebSocketPort

int? Photon.LoadBalancing.GameServer.GameApplication.GamingWebSocketPort
getprotected set

◆ IsMaster

bool Photon.LoadBalancing.GameServer.GameApplication.IsMaster
getsetprotected

◆ MasterEndPoint

IPEndPoint Photon.LoadBalancing.GameServer.GameApplication.MasterEndPoint
getprotected set

◆ MasterServerConnection

MasterServerConnection Photon.LoadBalancing.GameServer.GameApplication.MasterServerConnection
get

◆ PublicIpAddress

IPAddress Photon.LoadBalancing.GameServer.GameApplication.PublicIpAddress
getprotected set

◆ PublicIpAddressIPv6

IPAddress Photon.LoadBalancing.GameServer.GameApplication.PublicIpAddressIPv6
getprotected set

◆ S2SCacheMan

S2SCustomTypeCacheMan Photon.LoadBalancing.GameServer.GameApplication.S2SCacheMan
getprotected set

◆ ServerId

Guid Photon.LoadBalancing.GameServer.GameApplication.ServerId
get

◆ TokenCreator

AuthTokenFactory Photon.LoadBalancing.GameServer.GameApplication.TokenCreator
getprotected set

◆ WorkloadController

WorkloadController Photon.LoadBalancing.GameServer.GameApplication.WorkloadController
getprotected set
Photon.LoadBalancing.GameServer.GameApplication.Setup
override void Setup()
This method is called when the current application has been started. The inheritor can setup log4net ...
Definition: GameApplication.cs:314
ExitGames.Logging
Definition: ILogger.cs:10
ExitGames.Logging.LogManager.SetLoggerFactory
static void SetLoggerFactory(ILoggerFactory factory)
Assigns a new ILoggerFactory to create ILogger instances.
Definition: LogManager.cs:86
Photon.LoadBalancing.GameServer.LogManager
ExitGames.Logging.LogManager LogManager
Definition: GameApplication.cs:44
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:23
ExitGames.Logging.Log4Net.Log4NetLoggerFactory.Instance
static readonly Log4NetLoggerFactory Instance
The singleton.
Definition: Log4NetLoggerFactory.cs:24
ExitGames.Logging.LogManager.GetCurrentClassLogger
static ILogger GetCurrentClassLogger()
Gets an ILogger for the calling class type.
Definition: LogManager.cs:60
ExitGames
Definition: CachedFunc.cs:10
ExitGames.Logging.Log4Net.Log4NetLoggerFactory
This ILoggerFactory creates ILogger that log to the log4net framework.
Definition: Log4NetLoggerFactory.cs:19