The base class for a Photon application. The main method to override is CreatePeer. See Setup for initialization recommendations. More...
Public Member Functions | |
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 | |
ApplicationBase () | |
Initializes a new instance of the ApplicationBase class. More... | |
abstract 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 IFiber | CreatePeerFiber (InitRequest request) |
virtual void | OnServerConnectionFailed (int errorCode, string errorMessage, object state) |
Invoked if a connection attempt to a server fails. More... | |
virtual 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... | |
abstract 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... | |
abstract void | TearDown () |
This method is called when the current application is being stopped. The inheritor can execute cleanup routines here. More... | |
new MarshalByRefObject | MemberwiseClone (bool cloneIdentity) |
Properties | |
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... | |
The base class for a Photon application. The main method to override is CreatePeer. See Setup for initialization recommendations.
|
inlineprotected |
Initializes a new instance of the ApplicationBase class.
|
inline |
Sends an event to a list of peers. This method serializes the data just once per protocol instead of once per peer.
TPeer | A PeerBase subclass type. |
eventData | The event to send. |
peers | The peers to send the event to. |
sendParameters | The send options. |
TPeer | : | PeerBase |
|
inline |
This method overload is obsolete; use ConnectToServerMuxTcp.
|
inline |
This method overload is obsolete; use ConnectToServerTcp.
|
inline |
This method overload is obsolete; use ConnectToServerUdp.
|
inline |
This method overload is obsolete; use ConnectToServerTcp.
|
inline |
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.
remoteEndPoint | The remote endpoint to connect to. |
applicationName | The application name to connect to. |
state | A state object that is returned with the callback. |
|
inline |
Establishes a TCP connection between two Photon instances. CreateServerPeer is called once the connection is established. OnServerConnectionFailed is called if the connection fails.
remoteEndPoint | The remote endpoint to connect to. |
applicationName | The application name to connect to. |
state | A state object that is returned with the callback. |
|
inline |
Establishes a TCP connection between two Photon instances. CreateServerPeer is called once the connection is established. OnServerConnectionFailed is called if the connection fails.
remoteEndPoint | The remote endpoint to connect to. |
applicationName | The application name to connect to. |
state | A state object that is returned with the callback. |
protocol | The IRpcProtocol used to serialze message data./> |
|
inline |
Establishes an UDP connection between two Photon instances. CreateServerPeer is called once the connection is established. OnServerConnectionFailed is called if the connection fails.
remoteEndPoint | The remote endpoint to connect to. |
applicationName | The application name to connect to. |
state | A state object that is returned with the callback. |
numChannels | The number of channels used by the connection. Channels are prioritized (the lower the channel number, the higher the priority) |
mtu | Maximum transfer unit - specifies the max data size of each UDP package (in bytes). Bigger packages will be fragmented. The default value is 1200. |
|
inline |
Establishes an WebSocket connection between two Photon instances. CreateServerPeer is called once the connection is established. OnServerConnectionFailed is called if the connection fails.
remoteEndPoint | The remote endpoint to connect to. |
applicationName | The application name to connect to. |
state | A state object that is returned with the callback. |
webSocketVersion | The websocket protocol version (currently supported: RF6455 and HyBi10) |
protocol | The protocol to serialize the message data. |
|
inline |
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.
remoteEndPoint | The remote endpoint to connect to. |
applicationName | The application name to connect to. |
state | A state object that is returned with the callback. |
origin | The origin of the request. |
|
inline |
|
protectedpure virtual |
This method is called by the IPhotonApplication.OnInit implementation of this class. The inheritor should return a PeerBase implementation.
initRequest | The initialization request. |
Implemented in Photon.LoadBalancing.GameServer.GameApplication, Photon.LoadBalancing.MasterServer.MasterApplication, Photon.MmoDemo.Server.PhotonApplication, Photon.Hive.HiveApplication, and Photon.CounterPublisher.Application.
|
inlineprotectedvirtual |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprotected |
|
inline |
|
inline |
|
inlineprotectedvirtual |
Invoked if a connection attempt to a server fails.
errorCode | The error code. |
errorMessage | The error message. |
state | The state. |
Reimplemented in Photon.LoadBalancing.GameServer.GameApplication.
|
inline |
Called when the application is started. This method calls Setup.
instanceName | The name of the instance. |
applicationName | Name of the application. |
sink | The sink. |
controlListners | The photon listener controler |
applicationsCounter | An IPhotonApplicationsCounter instance used to read photon socket server unmanged counters. |
unmanagedLogDirectory | The log path of Photon. |
|
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 in Photon.LoadBalancing.GameServer.GameApplication, and Photon.LoadBalancing.MasterServer.MasterApplication.
|
inline |
|
inline |
|
inline |
|
protectedpure virtual |
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:
Implemented in Photon.LoadBalancing.GameServer.GameApplication, Photon.LoadBalancing.MasterServer.MasterApplication, Photon.Hive.HiveApplication, Photon.MmoDemo.Server.PhotonApplication, Photon.CounterPublisher.Application, and Photon.LoadBalancing.UnitTests.UnifiedServer.OfflineExtra.TestApplication.
|
protectedpure virtual |
This method is called when the current application is being stopped. The inheritor can execute cleanup routines here.
Implemented in Photon.LoadBalancing.GameServer.GameApplication, Photon.LoadBalancing.MasterServer.MasterApplication, Photon.Hive.HiveApplication, Photon.MmoDemo.Server.PhotonApplication, and Photon.CounterPublisher.Application.
|
get |
Gets the application name set in PhotonServer.config.
|
get |
Gets the application path set in PhotonServer.config.
|
get |
Gets the path of the application root path - base location of all applications.
|
get |
Gets the path of the application binaries.
|
get |
Gets Photon Native Core version (PhotonSocketServer.exe).
|
get |
|
staticget |
Gets the application instance.
|
get |
Gets the number of peers currently connected to the application.
The peer count.
|
get |
Gets the name of the photon instance.
|
get |
Gets a value indicating whether the application is running (the time between Setup and OnStopRequested).
|
get |
Gets Photon Managed Core version (SDK).
|
get |
Gets the log path of Photon.