Represents a client peer that manages socket connections, sends and receives operations, and handles various socket events such as connection, disconnection, and errors. Inherits from ClientPeer and implements ISocketClientPeer and IAfterAutoBind.
More...
|
| SocketClientPeer (string serverAddress, IClientPeerInitRequest initRequest, TcpClientOptions tcpClientOptions, UdpClientOptions udpClientOptions, TransportProtocol protocol) |
| Initializes a new instance of the SocketClientPeer class for a specific transport protocol.
|
|
| SocketClientPeer (string serverAddress, IClientPeerInitRequest initRequest, TcpClientOptions tcpClientOptions, UdpClientOptions udpClientOptions, SslTransportProtocol sslProtocol, SslOptions sslOptions) |
| Initializes a new instance of the SocketClientPeer class for a specific SSL transport protocol.
|
|
void | OnAfterAutoBind () |
| Executes any additional logic after auto-binding of dependencies.
|
|
override INetworkStatistics | GetNetworkStatistics () |
| Retrieves the network statistics associated with this socket client peer.
|
|
ISocketClient | GetSocketClient () |
| Retrieves the underlying socket client associated with this peer.
|
|
void | Send (OperationEvent operationEvent, SendParameters sendParameters) |
| Sends an operation event to the server.
|
|
bool | Connect (bool autoReconnect=false, OnConnected onConnected=null, OnDisconnected onDisconnected=null) |
| Establishes a connection to the server.
|
|
bool | Reconnect (bool autoReconnect=false, OnConnected onConnected=null, OnDisconnected onDisconnected=null) |
| Reconnects to the server.
|
|
bool | Disconnect () |
| Disconnects from the server.
|
|
override bool | IsConnected () |
| Checks if the client peer is currently connected to the server.
|
|
override void | Service () |
| Services the socket client peer, handling various events such as connection, disconnection, errors, and operation events.
|
|
| 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.
|
|
void | SetDebugSupport (IDebugSupport debugSupport) |
| Sets the debug support for this client peer.
|
|
void | SetAuthToken (string authToken) |
| Sets the authentication token for this client peer.
|
|
|
virtual ISocketPingPong | NewSocketPingPong () |
| Creates a new instance of the ping-pong service for managing keep-alive pings.
|
|
virtual ISocketClient | NewTcpClient (string host, int port, TcpClientOptions tcpClientOptions) |
| Creates a new TCP socket client.
|
|
virtual ISocketClient | NewSslClient (string host, int port, TcpClientOptions tcpClientOptions, SslOptions sslOptions) |
| Creates a new SSL socket client.
|
|
virtual ISocketClient | NewUdpClient (string host, int port, UdpClientOptions udpClientOptions) |
| Creates a new UDP socket client.
|
|
virtual ISocketClient | NewWsClient (string host, int port, TcpClientOptions tcpClientOptions) |
| Creates a new WebSocket client.
|
|
virtual ISocketClient | NewWssClient (string host, int port, TcpClientOptions tcpClientOptions, SslOptions sslOptions) |
| Creates a new secure WebSocket client.
|
|
void | OnSocketClientConnected () |
| Handles the socket client's connected event.
|
|
void | OnSocketClientDisconnected () |
| Handles the socket client's disconnected event.
|
|
void | OnSocketClientReceived (byte[] buffer, int position, int length) |
| Handles the socket client's received event, processing incoming data.
|
|
void | OnSocketClientError (System.Net.Sockets.SocketError error) |
| Handles the socket client's error event.
|
|
virtual void | OnAutoReconnect (int reconnectInSeconds) |
| On AutoReconnect call to reconnect the socket.
|
|
override void | SendOperation (OperationRequestPending operationRequestPending) |
| Sends an operation request to the server.
|
|
virtual void | SendOperation (OperationEventPending operationEventPending) |
| Sends an operation event to the server.
|
|
void | LogEnqueue (OperationEventPending operationEventPending) |
| Logs the enqueuing of an operation event.
|
|
void | LogSend (OperationEventPending operationEventPending) |
| Logs the sending of an operation event.
|
|
void | LogEvent (OperationEvent operationEvent) |
| Logs the reception of an operation event.
|
|
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.
|
|
|
override string | logPrefix [get] |
| Prefix used in logging messages specific to this socket client peer.
|
|
ISocketSessionEmitService | socketSessionEmitService [get] |
| Service responsible for emitting socket session events.
|
|
ISocketOperationModelService | operationModelService [get] |
| Service responsible for handling operation models.
|
|
IEventService | eventService [get] |
| Service for handling various events within the client peer.
|
|
ISocketClient | socketClient [get] |
| The underlying socket client associated with this peer.
|
|
ISocketPingPong | socketPingPong [get] |
| Service responsible for managing the ping-pong operation to keep the connection alive.
|
|
OnConnected | OnConnected [get, set] |
| Event triggered when a connection is successfully established.
|
|
OnDisconnected | OnDisconnected [get, set] |
| Event triggered when a disconnection occurs.
|
|
OnOperationEvent | OnOperationEvent [get, set] |
| Event triggered when an operation event is received.
|
|
OnError | OnError [get, set] |
| Event triggered when a socket error occurs.
|
|
object | _lockOperationEventPending [get] |
| Lock object for synchronizing access to pending operation events.
|
|
OnConnected | onImmediatelyConnected [get, set] |
| Callback for immediate connection events.
|
|
OnDisconnected | onImmediatelyDisconnected [get, set] |
| Callback for immediate disconnection events.
|
|
object | _lockOther [get] |
| Lock object for synchronizing access to other fields.
|
|
bool | isDisconnectedNotice [get, set] |
| Indicates if a disconnection notice has been sent.
|
|
bool | isConnectedNotice [get, set] |
| Indicates if a connection notice has been sent.
|
|
bool | isErrorNotice [get, set] |
| Indicates if an error notice has been sent.
|
|
System.Net.Sockets.SocketError | socketError [get, set] |
| The socket error that occurred.
|
|
DisconnectReason | disconnectReason [get, set] |
| The reason for the disconnection.
|
|
string | disconnectMessage [get, set] |
| The message describing the disconnection.
|
|
string | serverSessionId [get] |
| The session ID provided by the server.
|
|
int | connectionId [get] |
| The connection ID assigned to this peer.
|
|
byte[] | encryptKey [get] |
| The encryption key used for securing communications.
|
|
Task | reconnectTask [get, set] |
| Task for managing reconnection attempts.
|
|
int | autoReconnectInSeconds [get, set] |
| The delay in seconds before attempting to auto-reconnect.
|
|
int | reconnectCount [get, set] |
| The current count of reconnection attempts.
|
|
UdpClientOptions | udpClientOptions [get] |
| Options for configuring the UDP client.
|
|
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.
|
|
Represents a client peer that manages socket connections, sends and receives operations, and handles various socket events such as connection, disconnection, and errors. Inherits from ClientPeer and implements ISocketClientPeer and IAfterAutoBind.