Photon Server API

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

Incoming OperationRequests are often answered with a response (represented by this class). It can be sent to the client by using the PeerBase.SendOperationResponse method. The IRpcProtocol.SerializeOperationResponse method serializes OperationResponse instances. SetParameters(object) converts properties that are flagged with DataMemberAttribute into the Parameters dictionary. More...

Public Member Functions

 OperationResponse ()
 Initializes a new instance of the OperationResponse class. More...
 
 OperationResponse (byte operationCode)
 Initializes a new instance of the OperationResponse class. This constructor sets the OperationCode. More...
 
 OperationResponse (byte operationCode, object dataContract)
 Initializes a new instance of the OperationResponse class. This constructor calls SetParameters(object) and sets the OperationCode. More...
 
 OperationResponse (byte operationCode, Dictionary< byte, object > parameters)
 Initializes a new instance of the OperationResponse class. This constructor sets the Parameters and the OperationCode. More...
 
void SetParameters (object dataContract)
 Converts properties of an object to response Parameters. Included properties require the DataMemberAttribute. More...
 
void SetParameters (Dictionary< byte, object > parameters)
 Replaces the Parameters with parameters . More...
 

Properties

string DebugMessage [get, set]
 Gets or sets the debug message. Error code 0 returns typically debug message "Ok". More...
 
byte OperationCode [get, set]
 Gets or sets the operation code. It allows the client to idenitfy which operation was answered. More...
 
Dictionary< byte, object > Parameters [get, set]
 Gets or sets the response parameters. More...
 
object this[byte parameterKey] [get, set]
 Gets or sets the paramter associated with the specified key. More...
 
short ReturnCode [get, set]
 Gets or sets the error code. Code 0 means OK. More...
 

Detailed Description

Incoming OperationRequests are often answered with a response (represented by this class). It can be sent to the client by using the PeerBase.SendOperationResponse method. The IRpcProtocol.SerializeOperationResponse method serializes OperationResponse instances. SetParameters(object) converts properties that are flagged with DataMemberAttribute into the Parameters dictionary.

Constructor & Destructor Documentation

◆ OperationResponse() [1/4]

Photon.SocketServer.OperationResponse.OperationResponse ( )
inline

Initializes a new instance of the OperationResponse class.

◆ OperationResponse() [2/4]

Photon.SocketServer.OperationResponse.OperationResponse ( byte  operationCode)
inline

Initializes a new instance of the OperationResponse class. This constructor sets the OperationCode.

Parameters
operationCodeDetermines the OperationCode.

◆ OperationResponse() [3/4]

Photon.SocketServer.OperationResponse.OperationResponse ( byte  operationCode,
object  dataContract 
)
inline

Initializes a new instance of the OperationResponse class. This constructor calls SetParameters(object) and sets the OperationCode.

Parameters
operationCodeDetermines the OperationCode.
dataContractAll properties of the dataContract with the DataMemberAttribute are copied to the Parameters dictionary.

◆ OperationResponse() [4/4]

Photon.SocketServer.OperationResponse.OperationResponse ( byte  operationCode,
Dictionary< byte, object >  parameters 
)
inline

Initializes a new instance of the OperationResponse class. This constructor sets the Parameters and the OperationCode.

Parameters
operationCodeDetermines the OperationCode.
parametersDetermines the Parameters.

Member Function Documentation

◆ SetParameters() [1/2]

void Photon.SocketServer.OperationResponse.SetParameters ( Dictionary< byte, object >  parameters)
inline

Replaces the Parameters with parameters .

Parameters
parametersThe parameters to set.

◆ SetParameters() [2/2]

void Photon.SocketServer.OperationResponse.SetParameters ( object  dataContract)
inline

Converts properties of an object to response Parameters. Included properties require the DataMemberAttribute.

Parameters
dataContractProperties of this object with the the DataMemberAttribute converted to Parameters.

Property Documentation

◆ DebugMessage

string Photon.SocketServer.OperationResponse.DebugMessage
getset

Gets or sets the debug message. Error code 0 returns typically debug message "Ok".

◆ OperationCode

byte Photon.SocketServer.OperationResponse.OperationCode
getset

Gets or sets the operation code. It allows the client to idenitfy which operation was answered.

◆ Parameters

Dictionary<byte, object> Photon.SocketServer.OperationResponse.Parameters
getset

Gets or sets the response parameters.

◆ ReturnCode

short Photon.SocketServer.OperationResponse.ReturnCode
getset

Gets or sets the error code. Code 0 means OK.

◆ this[byte parameterKey]

object Photon.SocketServer.OperationResponse.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.