ProtonNet Server 1.0
An Open Solution for all your socket or web api needs.
|
Abstract class representing a client peer in the network communication system. Handles sending and receiving of operation requests, managing response timings, and providing debug support. More...
Public Member Functions | |
ClientPeer (string serverAddress, IClientPeerInitRequest initRequest, TcpClientOptions tcpClientOptions) | |
Initializes a new instance of the ClientPeer class. | |
INetworkStatistics | GetNetworkStatistics () |
Abstract method to retrieve network statistics for the client peer. Must be implemented by derived classes. | |
int | GetClientId () |
Gets the unique client ID for this client peer. | |
int | GetPing () |
Gets the current ping (round-trip time) to the server. | |
int | GetSendRate () |
Gets the rate at which data is sent by this client peer. | |
void | SetSendRate (int sendRate) |
Sets the rate at which data is sent by this client peer. | |
void | Send (OperationRequest operationRequest, Action< OperationResponse > onOperationResponse, SendParameters sendParameters, int timeoutInSeconds) |
Sends an operation request to the server. | |
Task< OperationResponse > | SendAsync (OperationRequest operationRequest, SendParameters sendParameters=default, int timeoutInSeconds=15) |
Asynchronously sends an operation request to the server. | |
virtual bool | IsConnected () |
Determines whether the client peer is currently connected. | |
virtual void | Service () |
Services the client peer, processing any pending tasks or requests. | |
void | SetDebugSupport (IDebugSupport debugSupport) |
Sets the debug support for this client peer. | |
void | SetAuthToken (string authToken) |
Sets the authentication token for this client peer. | |
Public Member Functions inherited from XmobiTea.ProtonNet.Client.IClientPeer |
Protected Member Functions | |
void | AddWaitingResponseOperationRequestPending (OperationRequestPending operationRequestPending) |
Adds an operation request to the list of those waiting for a response. | |
OperationRequestPending | CreateNewOperationRequestPending (OperationRequest operationRequest, Action< OperationResponse > onOperationResponse, SendParameters sendParameters, int timeoutInSeconds) |
Creates a new instance of OperationRequestPending for the given operation request. | |
void | SendOperation (OperationRequestPending operationRequestPending) |
Abstract method to send an operation request to the server. Must be implemented by derived classes. | |
void | LogEnqueue (OperationRequestPending operationRequestPending) |
Logs the enqueuing of an operation request. | |
void | LogSend (OperationRequestPending operationRequestPending) |
Logs the sending of an operation request. | |
void | LogRecv (OperationRequestPending operationRequestPending) |
Logs the reception of an operation response. | |
Properties | |
string | logPrefix [get] |
Prefix used in logging messages specific to this client peer. | |
ILogger | logger [get] |
Logger instance for logging activities within the client peer. | |
object | _lockWaitingResponseOperationRequestPendings [get] |
Lock object to synchronize access to waiting response operation requests. | |
List< OperationRequestPending > | waitingResponseOperationRequestPendings [get] |
List of operation requests that are awaiting a response from the server. | |
object | _lockNeedRemoveOperationRequestPendings [get] |
Lock object to synchronize access to operation requests that need to be removed. | |
IDebugSupport | debugSupport [get, set] |
Debug support instance for logging and monitoring operations. | |
float | updateInterval [get] |
Interval at which updates are sent, in seconds. | |
string | authToken [get] |
Authentication token used for server communication. | |
string | serverAddress [get] |
Address of the server to which this client peer is connected. | |
string | sessionId [get] |
Session ID for the current connection session. | |
int | clientId [get] |
Unique client ID assigned to this client peer. | |
IRpcProtocolService | rpcProtocolService [get, set] |
RPC protocol service used by this client peer. | |
TcpClientOptions | tcpClientOptions [get] |
Options for configuring TCP client connections. | |
Abstract class representing a client peer in the network communication system. Handles sending and receiving of operation requests, managing response timings, and providing debug support.
XmobiTea.ProtonNet.Client.ClientPeer.ClientPeer | ( | string | serverAddress, |
IClientPeerInitRequest | initRequest, | ||
TcpClientOptions | tcpClientOptions ) |
Initializes a new instance of the ClientPeer class.
serverAddress | The address of the server to connect to. |
initRequest | The initial request containing session and client ID information. |
tcpClientOptions | Options for configuring the TCP client. |
|
protected |
Adds an operation request to the list of those waiting for a response.
operationRequestPending | The operation request to add. |
|
protected |
Creates a new instance of OperationRequestPending for the given operation request.
operationRequest | The operation request to process. |
onOperationResponse | Callback for handling the server's response. |
sendParameters | Parameters for sending the request. |
timeoutInSeconds | Timeout for the request in seconds. |
int XmobiTea.ProtonNet.Client.ClientPeer.GetClientId | ( | ) |
Gets the unique client ID for this client peer.
Implements XmobiTea.ProtonNet.Client.IClientPeer.
|
abstract |
Abstract method to retrieve network statistics for the client peer. Must be implemented by derived classes.
Implements XmobiTea.ProtonNet.Client.IClientPeer.
int XmobiTea.ProtonNet.Client.ClientPeer.GetPing | ( | ) |
Gets the current ping (round-trip time) to the server.
Implements XmobiTea.ProtonNet.Client.IClientPeer.
int XmobiTea.ProtonNet.Client.ClientPeer.GetSendRate | ( | ) |
Gets the rate at which data is sent by this client peer.
Implements XmobiTea.ProtonNet.Client.IClientPeer.
|
virtual |
Determines whether the client peer is currently connected.
Reimplemented in XmobiTea.ProtonNet.Client.Socket.SocketClientPeer, and XmobiTea.ProtonNet.Client.WebApi.AbstractWebApiClientPeer.
|
protected |
Logs the enqueuing of an operation request.
operationRequestPending | The pending operation request to log. |
|
protected |
Logs the reception of an operation response.
operationRequestPending | The pending operation request to log. |
|
protected |
Logs the sending of an operation request.
operationRequestPending | The pending operation request to log. |
void XmobiTea.ProtonNet.Client.ClientPeer.Send | ( | OperationRequest | operationRequest, |
Action< OperationResponse > | onOperationResponse, | ||
SendParameters | sendParameters, | ||
int | timeoutInSeconds ) |
Sends an operation request to the server.
operationRequest | The operation request to send. |
onOperationResponse | Callback for handling the server's response. |
sendParameters | Parameters for sending the request. |
timeoutInSeconds | Timeout for the request in seconds. |
Implements XmobiTea.ProtonNet.Client.IClientPeer.
Task< OperationResponse > XmobiTea.ProtonNet.Client.ClientPeer.SendAsync | ( | OperationRequest | operationRequest, |
SendParameters | sendParameters = default, | ||
int | timeoutInSeconds = 15 ) |
Asynchronously sends an operation request to the server.
operationRequest | The operation request to send. |
sendParameters | Parameters for sending the request. |
timeoutInSeconds | Timeout for the request in seconds. |
Implements XmobiTea.ProtonNet.Client.IClientPeer.
|
abstractprotected |
Abstract method to send an operation request to the server. Must be implemented by derived classes.
operationRequestPending | The pending operation request to send. |
|
virtual |
Services the client peer, processing any pending tasks or requests.
Implements XmobiTea.ProtonNet.Client.IClientPeer.
Reimplemented in XmobiTea.ProtonNet.Client.Socket.SocketClientPeer.
void XmobiTea.ProtonNet.Client.ClientPeer.SetAuthToken | ( | string | authToken | ) |
Sets the authentication token for this client peer.
authToken | The authentication token to set. |
Implements XmobiTea.ProtonNet.Client.IClientPeer.
void XmobiTea.ProtonNet.Client.ClientPeer.SetDebugSupport | ( | IDebugSupport | debugSupport | ) |
Sets the debug support for this client peer.
debugSupport | The debug support to set. |
Implements XmobiTea.ProtonNet.Client.IClientPeer.
void XmobiTea.ProtonNet.Client.ClientPeer.SetSendRate | ( | int | sendRate | ) |
Sets the rate at which data is sent by this client peer.
sendRate | The send rate in frames per second. |
Implements XmobiTea.ProtonNet.Client.IClientPeer.