Photon .NET Client API 4.1.4.8

Public Member Functions | Public Attributes | Properties | List of all members
Photon.Chat.ChatPeer Class Reference

Provides basic operations of the Photon Chat server. This internal class is used by public ChatClient. More...

Inheritance diagram for Photon.Chat.ChatPeer:
ExitGames.Client.Photon.PhotonPeer

Public Member Functions

 ChatPeer (IPhotonPeerListener listener, ConnectionProtocol protocol)
 Chat Peer constructor. More...
 
bool Connect ()
 Connects to NameServer. More...
 
bool AuthenticateOnNameServer (string appId, string appVersion, string region, AuthenticationValues authValues)
 Authenticates on NameServer. More...
 
- Public Member Functions inherited from ExitGames.Client.Photon.PhotonPeer
string CommandLogToString ()
 Obsolete and ignored. Converts the CommandLog into a readable table-like string with summary. More...
 
void TrafficStatsReset ()
 Creates new instances of TrafficStats and starts a new timer for those. More...
 
string VitalStatsToString (bool all)
 Returns a string of the most interesting connection statistics. When you have issues on the client side, these might contain hints about the issue's cause. More...
 
 PhotonPeer (ConnectionProtocol protocolType)
 Creates a new PhotonPeer with specified transport protocol (without a IPhotonPeerListener). More...
 
 PhotonPeer (IPhotonPeerListener listener, ConnectionProtocol protocolType)
 Creates a new PhotonPeer instance to communicate with Photon and selects the transport protocol. We recommend UDP. More...
 
virtual bool Connect (string serverAddress, string appId, object custom=null)
 Starts connecting to the given Photon server. Non-blocking. More...
 
virtual bool Connect (string serverAddress, string proxyServerAddress, string appId, object custom)
 Starts connecting to the given Photon server. Non-blocking. More...
 
virtual void Disconnect ()
 This method initiates a mutual disconnect between this client and the server. More...
 
virtual void StopThread ()
 This method immediately closes a connection (pure client side) and ends related listening Threads. More...
 
virtual void FetchServerTimestamp ()
 This will fetch the server's timestamp and update the approximation for property ServerTimeInMilliseconds. More...
 
bool EstablishEncryption ()
 This method creates a public key for this client and exchanges it with the server. More...
 
bool InitDatagramEncryption (byte[] encryptionSecret, byte[] hmacSecret, bool randomizedSequenceNumbers=false, bool chaningModeGCM=false)
 Initializes Datagram Encryption. Optionally, the EncryptorType is being used, if set. More...
 
void InitPayloadEncryption (byte[] secret)
 Photon's Payload Encryption secret may be set by a response from the server. More...
 
virtual void Service ()
 This method excutes DispatchIncomingCommands and SendOutgoingCommands in your application Thread-context. More...
 
virtual bool SendOutgoingCommands ()
 Creates and sends a UDP/TCP package with outgoing commands (operations and acknowledgements). Also called by Service(). More...
 
virtual bool SendAcksOnly ()
 
virtual bool DispatchIncomingCommands ()
 Dispatching received messages (commands), causes callbacks for events, responses and state changes within a IPhotonPeerListener. More...
 
virtual bool SendOperation (byte operationCode, Dictionary< byte, object > operationParameters, SendOptions sendOptions)
 Prepares your operation (code and parameters) to be sent to the Photon Server with specified SendOptions. More...
 
virtual bool SendOperation (byte operationCode, ParameterDictionary operationParameters, SendOptions sendOptions)
 

Public Attributes

string NameServerHost = "ns.exitgames.com"
 Name Server Host Name for Photon Cloud. Without port and without any prefix. More...
 
ushort NameServerPortOverride
 If not zero, this is used for the name server port on connect. Independent of protocol (so this better matches). Set by ChatClient.ConnectUsingSettings. More...
 
- Public Attributes inherited from ExitGames.Client.Photon.PhotonPeer
int WarningSize
 The WarningSize was used test all message queues for congestion. More...
 
int CommandLogSize
 Obsolete and ignored. Size of CommandLog. Default is 0, no logging. More...
 
TargetFrameworks TargetFramework = TargetFrameworks.Net35
 Target framework this dll was built for. More...
 
bool RemoveAppIdFromWebSocketPath
 Can be used to remove/hide the AppId from websocket connect paths. More...
 
Dictionary< ConnectionProtocol, Type > SocketImplementationConfig
 Optional definition of IPhotonSocket type per ConnectionProtocol. More...
 
DebugLevel DebugOut = DebugLevel.ERROR
 Sets the level (and amount) of debug output provided by the library. More...
 
bool SendInCreationOrder = true
 This debug setting enables a new send-ordering for commands. Defaults to true and commands are sent in the order they are created. Set to false to use Enet ordering. More...
 
ITrafficRecorder TrafficRecorder
 If set, the TrafficRecorder will be used to capture all traffic. More...
 
byte ChannelCount = 2
 Gets / sets the number of channels available in UDP connections with Photon. Photon Channels are only supported for UDP. The default ChannelCount is 2. Channel IDs start with 0 and 255 is a internal channel. More...
 
bool EnableEncryptedFlag = false
 Enables the client so send the "encrypted" flag on secure connections. Incompatible with Server SDK 4.x. More...
 
int SentCountAllowance = 7
 Number of send retries before a peer is considered lost/disconnected. Default: 7. More...
 
int InitialResendTimeMax = 400
 Caps the initial timing for repeats of reliable commands. In milliseconds. Default: 400ms. More...
 
int TimePingInterval = 1000
 Sets the time between pings being sent automatically. They measure the roundtrip time and keep connections from closing. Default: 1000. More...
 

Properties

string NameServerAddress [get]
 Name Server Address for Photon Cloud (based on current protocol). You can use the default values and usually won't have to set this value. More...
 
- Properties inherited from ExitGames.Client.Photon.PhotonPeer
int CommandBufferSize [get, set]
 No effect anymore. Removed without replacement. More...
 
int LimitOfUnreliableCommands [get, set]
 No effect anymore. Removed without replacement. More...
 
int LocalTimeInMilliSeconds [get]
 Gets a local timestamp in milliseconds by calling SupportClass.GetTickCount(). See LocalMsTimestampDelegate. More...
 
string ClientVersion [get]
 Version of this library as string. More...
 
static bool NativeSocketLibAvailable [get]
 Checks if a native library for network sockets (PhotonSocketPlugin.dll) is available. To use it, see remarks. More...
 
static bool NativePayloadEncryptionLibAvailable [get]
 Checks if native library for Payload Encryption (PhotonCryptoPlugin.dll) is available. Used automatically. More...
 
static bool NativeDatagramEncryptionLibAvailable [get]
 Checks if a native library for Datagram Encryption is available. To use it, see remarks. More...
 
SerializationProtocol SerializationProtocolType [get, set]
 Enables selection of a (Photon-)serialization protocol. Used in Connect methods. More...
 
Type SocketImplementation [get, set]
 Can be used to read the IPhotonSocket implementation at runtime (before connecting). More...
 
IPhotonPeerListener Listener [get, protected set]
 Gets the IPhotonPeerListener of this instance (set in constructor). Can be used in derived classes for Listener.DebugReturn(). More...
 
bool ReuseEventInstance [get, set]
 Option to make the PhotonPeer reuse a single EventData instance for all incoming events. More...
 
bool UseByteArraySlicePoolForEvents [get, set]
 Enables a deserialization optimization for incoming events. Defaults to false. More...
 
bool WrapIncomingStructs [get, set]
 Incoming struct types are wrapped in a pooled IWrapperStruct, rather than being cast to object. This eliminated allocations and garbage collection from boxing, however object that are wrapped structs will need to be cast to WrapperStruct<T> and their values extracted with (obj as WrapperStruct<T>).Value. More...
 
ByteArraySlicePool ByteArraySlicePool [get]
 Instance of a ByteArraySlicePool. UseByteArraySlicePoolForEvents defines if this PhotonPeer is using the pool for deserialization of byte[] in Photon events. More...
 
long BytesIn [get]
 Gets count of all bytes coming in (including headers, excluding UDP/TCP overhead) More...
 
long BytesOut [get]
 Gets count of all bytes going out (including headers, excluding UDP/TCP overhead) More...
 
int ByteCountCurrentDispatch [get]
 Gets the size of the dispatched event or operation-result in bytes. This value is set before OnEvent() or OnOperationResponse() is called (within DispatchIncomingCommands()). More...
 
string? CommandInfoCurrentDispatch [get]
 Returns the debug string of the event or operation-response currently being dispatched or string. Empty if none. More...
 
int ByteCountLastOperation [get]
 Gets the size of the last serialized operation call in bytes. The value includes all headers for this single operation but excludes those of UDP, Enet Package Headers and TCP. More...
 
bool EnableServerTracing [get, set]
 Debugging option to tell the Photon Server to log all datagrams. More...
 
byte QuickResendAttempts [get, set]
 Up to 4 resend attempts for a reliable command can be done in quick succession (after RTT+4*Variance). More...
 
PeerStateValue PeerState [get]
 This is the (low level) state of the connection to the server of a PhotonPeer. Managed internally and read-only. More...
 
string PeerID [get]
 This peer's ID as assigned by the server or 0 if not using UDP. Will be 0xFFFF before the client connects. More...
 
int QueuedIncomingCommands [get]
 Count of all currently received but not-yet-Dispatched reliable commands (events and operation results) from all channels. More...
 
int QueuedOutgoingCommands [get]
 Count of all commands currently queued as outgoing, including all channels and reliable, unreliable. More...
 
bool CrcEnabled [get, set]
 While not connected, this controls if the next connection(s) should use a per-package CRC checksum. More...
 
int PacketLossByCrc [get]
 Count of packages dropped due to failed CRC checks for this connection. More...
 
int PacketLossByChallenge [get]
 Count of packages dropped due to wrong challenge for this connection. More...
 
int SentReliableCommandsCount [get]
 Gets the count of sent but not yet acknowledged commands (for UDP connections). More...
 
int? ResentReliableCommands [get]
 Count of commands that got repeated (due to local repeat-timing before an ACK was received). More...
 
int DisconnectTimeout [get, set]
 Time in milliseconds before any sent reliable command triggers a timeout disconnect, unless acknowledged by the receiver. Default: 10000. More...
 
int? ServerTimeInMilliSeconds [get]
 Approximated Environment.TickCount value of server (while connected). More...
 
SupportClass.IntegerMillisecondsDelegate LocalMsTimestampDelegate [set]
 This setter for the (local-) timestamp delegate replaces the default Environment.TickCount with any equal function. More...
 
int ConnectionTime [get]
 The internally used "per connection" time value, which is updated infrequently, when the library executes some connectio-related tasks. More...
 
int LastSendAckTime [get]
 The last ConnectionTime value, when some ACKs were sent out by this client. More...
 
int LastSendOutgoingTime [get]
 The last ConnectionTime value, when SendOutgoingCommands actually checked outgoing queues to send them. Must be connected. More...
 
int LongestSentCall [get, set]
 Measures the maximum milliseconds spent in PhotonSocket.Send(). More...
 
int RoundTripTime [get]
 Time until a reliable command is acknowledged by the server. More...
 
int RoundTripTimeVariance [get]
 Changes of the roundtriptime as variance value. Gives a hint about how much the time is changing. More...
 
int LastRoundTripTime [get]
 The last measured roundtrip time for this connection. More...
 
int TimestampOfLastSocketReceive [get]
 Timestamp of the last time anything (!) was received from the server (including low level Ping, ACKs, events and operation-returns). More...
 
string ServerAddress [get]
 The server address which was used in PhotonPeer.Connect() or null (before Connect() was called). More...
 
string ServerIpAddress [get]
 Contains the IP address of the previously resolved ServerAddress (or empty, if address wasn't resolved with the internal methods). More...
 
ConnectionProtocol UsedProtocol [get]
 The protocol this peer is currently connected/connecting with (or 0). More...
 
ConnectionProtocol TransportProtocol [get, set]
 This is the transport protocol to be used for next connect (see remarks). More...
 
virtual bool IsSimulationEnabled [get, set]
 Gets or sets the network simulation "enabled" setting. Changing this value also locks this peer's sending and when setting false, the internally used queues are executed (so setting to false can take some cycles). More...
 
NetworkSimulationSet NetworkSimulationSettings [get]
 Gets the settings for built-in Network Simulation for this peer instance while IsSimulationEnabled will enable or disable them. Once obtained, the settings can be modified by changing the properties. More...
 
int MaximumTransferUnit [get, set]
 The Maximum Trasfer Unit (MTU) defines the (network-level) packet-content size that is guaranteed to arrive at the server in one piece. The Photon Protocol uses this size to split larger data into packets and for receive-buffers of packets. More...
 
bool IsEncryptionAvailable [get]
 This property is set internally, when OpExchangeKeysForEncryption successfully finished. While it's true, encryption can be used for operations. More...
 
bool IsSendingOnlyAcks [get, set]
 While true, the peer will not send any other commands except ACKs (used in UDP connections). More...
 
TrafficStats TrafficStatsIncoming [get, set]
 Gets the byte-count of incoming "low level" messages, which are either Enet Commands or Tcp Messages. These include all headers, except those of the underlying internet protocol Udp or Tcp. More...
 
TrafficStats TrafficStatsOutgoing [get, set]
 Gets the byte-count of outgoing "low level" messages, which are either Enet Commands or Tcp Messages. These include all headers, except those of the underlying internet protocol Udp or Tcp. More...
 
TrafficStatsGameLevel TrafficStatsGameLevel [get, set]
 Gets a statistic of incoming and outgoing traffic, split by operation, operation-result and event. More...
 
long? TrafficStatsElapsedMs [get]
 Returns the count of milliseconds the stats are enabled for tracking. More...
 
bool TrafficStatsEnabled [get, set]
 Enables or disables collection of statistics in TrafficStatsIncoming, TrafficStatsOutgoing and TrafficstatsGameLevel. More...
 
Type EncryptorType [get, set]
 Setter for the Datagram Encryptor instance. Used at next connect. More...
 
int CountDiscarded [get, set]
 Count of unreliable commands being discarded in case this client already dispatched a command that was newer (higher sequence number). More...
 
int DeltaUnreliableNumber [get, set]
 Set per dispatch in DispatchIncomingCommands to: commandUnreliableSequenceNumber - channel.incomingUnreliableSequenceNumber. Indicates how big the (sequence)gap is, compared to the last dispatched unreliable command. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ExitGames.Client.Photon.PhotonPeer
static void MessageBufferPoolTrim (int countOfBuffers)
 Sets a new (temporary) size of the MessageBufferPool to reuse memory where possible. More...
 
static int MessageBufferPoolSize ()
 
static bool RegisterType (Type customType, byte code, SerializeMethod serializeMethod, DeserializeMethod constructor)
 Registers new types/classes for de/serialization and the fitting methods to call for this type. More...
 
static bool RegisterType (Type customType, byte code, SerializeStreamMethod serializeMethod, DeserializeStreamMethod constructor)
 
- Static Public Attributes inherited from ExitGames.Client.Photon.PhotonPeer
const bool NativeDatagramEncrypt = true
 Where dynamic linking is available, this library will attempt to load a native Photon "Encryptor" plugin library for "Datagram Encryption". More...
 
const bool NoSocket = false
 False if this library build contains C# Socket code. If true, you must set some type as SocketImplementation before connecting. More...
 
const bool DebugBuild = false
 True if the library was compiled with DEBUG setting. More...
 
const int NativeEncryptorApiVersion = 2
 Version of the Native Encryptor API compiled into this assembly. Defines which PhotonEncryptorPlugin needs to be used. More...
 
static bool NoNativeCallbacks
 Global toggle to avoid callbacks from native plugins. Defaults to false, meaning: "callbacks enabled". More...
 
static int OutgoingStreamBufferSize = 1200
 Defines the initial size of an internally used StreamBuffer for Tcp. The StreamBuffer is used to aggregate operation into (less) send calls, which uses less resoures. More...
 
static bool AsyncKeyExchange = false
 Defines if Key Exchange for Encryption is done asynchronously in another thread. More...
 
- Events inherited from ExitGames.Client.Photon.PhotonPeer
Action< DisconnectMessageOnDisconnectMessage
 Called when the client received a Disconnect Message from the server. Signals an error and provides a message to debug the case. More...
 

Detailed Description

Provides basic operations of the Photon Chat server. This internal class is used by public ChatClient.

Constructor & Destructor Documentation

◆ ChatPeer()

Photon.Chat.ChatPeer.ChatPeer ( IPhotonPeerListener  listener,
ConnectionProtocol  protocol 
)
inline

Chat Peer constructor.

Parameters
listenerChat listener implementation.
protocolProtocol to be used by the peer.

Member Function Documentation

◆ AuthenticateOnNameServer()

bool Photon.Chat.ChatPeer.AuthenticateOnNameServer ( string  appId,
string  appVersion,
string  region,
AuthenticationValues  authValues 
)
inline

Authenticates on NameServer.

Returns
If the authentication operation request could be sent.

◆ Connect()

bool Photon.Chat.ChatPeer.Connect ( )
inline

Connects to NameServer.

Returns
If the connection attempt could be sent.

Member Data Documentation

◆ NameServerHost

string Photon.Chat.ChatPeer.NameServerHost = "ns.exitgames.com"

Name Server Host Name for Photon Cloud. Without port and without any prefix.

◆ NameServerPortOverride

ushort Photon.Chat.ChatPeer.NameServerPortOverride

If not zero, this is used for the name server port on connect. Independent of protocol (so this better matches). Set by ChatClient.ConnectUsingSettings.

This is reset when the protocol fallback is used.

Property Documentation

◆ NameServerAddress

string Photon.Chat.ChatPeer.NameServerAddress
get

Name Server Address for Photon Cloud (based on current protocol). You can use the default values and usually won't have to set this value.


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