Photon Server API Documentation v5.0RC1

Public Member Functions | Properties | List of all members
Photon.SocketServer.SerializedEventData Class Reference

An IEventData wrapper that serializes the event upon creation. This has a performance benefit if multiple receivers use the same protocol. More...

Inheritance diagram for Photon.SocketServer.SerializedEventData:
Photon.SocketServer.IEventData

Public Member Functions

 SerializedEventData (IEventData eventData, IRpcProtocol rpcProtocol, SerializeSetup setup)
 Initializes a new instance of the SerializedEventData class. More...
 
byte[] Serialize (IRpcProtocol protocol, SerializeSetup setup)
 Returns the cached serialization data if the protocol is matches, otherwise serializes with the protocol . More...
 

Properties

byte Code [get]
 Gets the event code. More...
 
IEventData EventData [get]
 Gets the event data. More...
 
Dictionary< byte, object > Parameters [get]
 Gets the event params. More...
 
object this[byte parameterKey] [get, set]
 Gets or sets the paramter associated with the specified key. More...
 
IRpcProtocol Protocol [get]
 Gets the used serialization protocol. More...
 
byte[] Data [get]
 Gets the serialized data. More...
 
- Properties inherited from Photon.SocketServer.IEventData
byte Code [get]
 Gets Code. More...
 
object this[byte parameterKey] [get, set]
 Gets or sets the paramter associated with the specified key. More...
 
Dictionary< byte, object > Parameters [get]
 Gets the event parameters that will be sent to the client. More...
 

Detailed Description

An IEventData wrapper that serializes the event upon creation. This has a performance benefit if multiple receivers use the same protocol.

Constructor & Destructor Documentation

◆ SerializedEventData()

Photon.SocketServer.SerializedEventData.SerializedEventData ( IEventData  eventData,
IRpcProtocol  rpcProtocol,
SerializeSetup  setup 
)
inline

Initializes a new instance of the SerializedEventData class.

Parameters
eventDataThe event data.
rpcProtocolThe rpc protocol.
setup

Member Function Documentation

◆ Serialize()

byte [] Photon.SocketServer.SerializedEventData.Serialize ( IRpcProtocol  protocol,
SerializeSetup  setup 
)
inline

Returns the cached serialization data if the protocol is matches, otherwise serializes with the protocol .

Parameters
protocolThe protocol.
setup
Returns
A byte array.

Implements Photon.SocketServer.IEventData.

Property Documentation

◆ Code

byte Photon.SocketServer.SerializedEventData.Code
get

Gets the event code.

◆ Data

byte [] Photon.SocketServer.SerializedEventData.Data
get

Gets the serialized data.

◆ EventData

IEventData Photon.SocketServer.SerializedEventData.EventData
get

Gets the event data.

◆ Parameters

Dictionary<byte, object> Photon.SocketServer.SerializedEventData.Parameters
get

Gets the event params.

◆ Protocol

IRpcProtocol Photon.SocketServer.SerializedEventData.Protocol
get

Gets the used serialization protocol.

◆ this[byte parameterKey]

object Photon.SocketServer.SerializedEventData.this[byte parameterKey]
getset

Gets or sets the paramter associated with the specified key.

Parameters
parameterKeyThe key of the parameter to get or set.
Returns
The parameter associated with the specified key. If the specified key is not found, a get operation throws a KeyNotFoundException, and a set operation creates a new paramter with the specified key.
Exceptions
System.NullReferenceExceptionThe Parameters property has not been initialized.