ProtonNet Server 1.0
An Open Solution for all your socket or web api needs.
|
Represents a secure WebSocket session that inherits from HttpsSession and implements WebSocket functionality. More...
Public Member Functions | |
WssSession(WssServer server) int | SendText (byte[] buffer) |
Initializes a new instance of the WssSession class with the specified WebSocket server. | |
int | SendText (byte[] buffer, int position, int length) |
Sends a text message synchronously to the WebSocket connection with a specified position and length. | |
bool | SendTextAsync (byte[] buffer) |
Sends a text message asynchronously to the WebSocket connection. | |
bool | SendTextAsync (byte[] buffer, int position, int length) |
Sends a text message asynchronously to the WebSocket connection with a specified position and length. | |
int | SendBinary (byte[] buffer) |
Sends a binary message synchronously to the WebSocket connection. | |
int | SendBinary (byte[] buffer, int position, int length) |
Sends a binary message synchronously to the WebSocket connection with a specified position and length. | |
bool | SendBinaryAsync (byte[] buffer) |
Sends a binary message asynchronously to the WebSocket connection. | |
bool | SendBinaryAsync (byte[] buffer, int position, int length) |
Sends a binary message asynchronously to the WebSocket connection with a specified position and length. | |
int | SendClose (int status, byte[] buffer) |
Sends a close frame synchronously to the WebSocket connection with the specified status code and buffer. | |
int | SendClose (int status, byte[] buffer, int position, int length) |
Sends a close frame synchronously to the WebSocket connection with the specified status code, buffer, position, and length. | |
bool | SendCloseAsync (int status, byte[] buffer) |
Sends a close frame asynchronously to the WebSocket connection with the specified status code and buffer. | |
bool | SendCloseAsync (int status, byte[] buffer, int position, int length) |
Sends a close frame asynchronously to the WebSocket connection with the specified status code, buffer, position, and length. | |
int | SendPing (byte[] buffer) |
Sends a ping frame synchronously to the WebSocket connection. | |
int | SendPing (byte[] buffer, int position, int length) |
Sends a ping frame synchronously to the WebSocket connection with a specified position and length. | |
bool | SendPingAsync (byte[] buffer) |
Sends a ping frame asynchronously to the WebSocket connection. | |
bool | SendPingAsync (byte[] buffer, int position, int length) |
Sends a ping frame asynchronously to the WebSocket connection with a specified position and length. | |
int | SendPong (byte[] buffer) |
Sends a pong frame synchronously to the WebSocket connection. | |
int | SendPong (byte[] buffer, int position, int length) |
Sends a pong frame synchronously to the WebSocket connection with a specified position and length. | |
bool | SendPongAsync (byte[] buffer) |
Sends a pong frame asynchronously to the WebSocket connection. | |
bool | SendPongAsync (byte[] buffer, int position, int length) |
Sends a pong frame asynchronously to the WebSocket connection with a specified position and length. | |
virtual void | OnWsConnecting (HttpRequest request) |
Called when a WebSocket connection is being established. | |
virtual void | OnWsConnected (HttpResponse response) |
Called when a WebSocket connection is successfully established. | |
virtual bool | OnWsConnecting (HttpRequest request, HttpResponse response) |
Called when a WebSocket connection is being established. | |
virtual void | OnWsConnected (HttpRequest request) |
Called when a WebSocket connection is successfully established. | |
virtual void | OnWsDisconnecting () |
Called when a WebSocket connection is being disconnected. | |
virtual void | OnWsDisconnected () |
Called when a WebSocket connection is successfully disconnected. | |
virtual void | OnWsReceived (byte[] buffer, int position, int length) |
Called when data is received from the WebSocket connection. | |
virtual void | OnWsClose (byte[] buffer, int position, int length, int status=1000) |
Called when a WebSocket connection is closed. | |
virtual void | OnWsPing (byte[] buffer, int position, int length) |
Called when a WebSocket ping is received. | |
virtual void | OnWsPong (byte[] buffer, int position, int length) |
Called when a WebSocket pong is received. | |
virtual void | OnWsError (string error) |
Called when a WebSocket error occurs with a custom error message. | |
virtual void | OnWsError (SocketError error) |
Called when a WebSocket error occurs with a SocketError instance. | |
void | SendUpgrade (HttpResponse response) |
Sends a WebSocket upgrade response to the client. | |
Public Member Functions inherited from XmobiTea.ProtonNetServer.HttpsSession | |
HttpsSession (HttpsServer server) | |
Initializes a new instance of the HttpsSession class. | |
virtual int | SendResponse (HttpResponse response) |
Sends an HTTP response synchronously. | |
virtual bool | SendResponseAsync (HttpResponse response) |
Sends an HTTP response asynchronously. | |
Public Member Functions inherited from XmobiTea.ProtonNetServer.SslSession | |
SslSession (SslServer server) | |
Initializes a new instance of the SslSession class. | |
INetworkStatistics | GetNetworkStatistics () |
Gets the network statistics for this session. | |
virtual bool | Disconnect () |
Disconnects the session, releasing all resources and closing the connection. | |
virtual int | Send (byte[] buffer) |
Sends data to the connected client. | |
virtual int | Send (byte[] buffer, int position, int length) |
Sends data to the connected client. | |
virtual bool | SendAsync (byte[] buffer) |
Asynchronously sends data to the connected client. | |
virtual bool | SendAsync (byte[] buffer, int position, int length) |
Asynchronously sends data to the connected client. | |
void | Dispose () |
Releases all resources used by the SslSession. | |
Public Member Functions inherited from XmobiTea.ProtonNetServer.ISession | |
Public Member Functions inherited from XmobiTea.ProtonNetServer.IHttpSession | |
Public Member Functions inherited from XmobiTea.ProtonNetCommon.IWebSocket | |
Public Member Functions inherited from XmobiTea.ProtonNetServer.IWsSession |
Protected Member Functions | |
override void | OnDisconnecting () |
Called when the session is disconnecting. | |
override void | OnDisconnected () |
Called when the session has been disconnected. | |
override void | OnReceived (byte[] buffer, int position, int length) |
Called when data is received from the connection. | |
override void | OnReceivedRequestHeader (HttpRequest request) |
Called when the HTTP request headers are received. | |
override void | OnReceivedRequest (HttpRequest request) |
Called when the complete HTTP request is received. | |
override void | OnReceivedRequestError (HttpRequest request, string error) |
Called when an error occurs while receiving the HTTP request. | |
Protected Member Functions inherited from XmobiTea.ProtonNetServer.HttpsSession | |
Protected Member Functions inherited from XmobiTea.ProtonNetServer.SslSession | |
virtual void | OnConnecting () |
Event triggered when the session is connecting. | |
virtual void | OnConnected () |
Event triggered when the session is connected. | |
virtual void | OnHandshaking () |
Event triggered when the SSL handshake process begins. | |
virtual void | OnHandshaked () |
Event triggered when the SSL handshake process is completed. | |
virtual void | OnSent (int sent, int pending) |
Event triggered when data is sent to the client. | |
virtual void | OnEmpty () |
Event triggered when the send buffer is empty. | |
virtual void | OnError (SocketError error) |
Event triggered when an error occurs in the session. | |
virtual void | Dispose (bool disposingManagedResources) |
Releases unmanaged and, optionally, managed resources. | |
Additional Inherited Members | |
Package Functions inherited from XmobiTea.ProtonNetServer.SslSession | |
Properties inherited from XmobiTea.ProtonNetServer.HttpsSession | |
HttpRequest | Request [get] |
Gets the current HTTP request being processed. | |
HttpResponse | Response [get] |
Gets the current HTTP response being processed. | |
Properties inherited from XmobiTea.ProtonNetServer.SslSession | |
bool | IsHandshaked [get] |
Gets a value indicating whether the session has completed the SSL handshake. | |
string | Id [get] |
Gets the unique identifier for this session. | |
SslServer | Server [get] |
Gets the associated server instance for this session. | |
Socket | Socket [get] |
Gets the underlying socket for the session. | |
bool | IsConnected [get] |
Gets a value indicating whether the session is currently connected. | |
bool | IsDisposed [get] |
Indicates whether this session has been disposed. This flag helps ensure that resources are not accessed after disposal. | |
bool | IsSocketDisposed [get] |
Indicates whether the underlying socket has been disposed. This flag is important for preventing operations on a closed socket. | |
TcpServerOptions | Options [get] |
Contains various configuration options for the TCP server. This includes settings like buffer sizes, keep-alive time, and more. | |
Represents a secure WebSocket session that inherits from HttpsSession and implements WebSocket functionality.
|
protectedvirtual |
Called when the session has been disconnected.
Reimplemented from XmobiTea.ProtonNetServer.HttpsSession.
|
protectedvirtual |
Called when the session is disconnecting.
Reimplemented from XmobiTea.ProtonNetServer.SslSession.
|
protectedvirtual |
Called when data is received from the connection.
buffer | The received data buffer. |
position | The starting position in the buffer. |
length | The length of the received data. |
Reimplemented from XmobiTea.ProtonNetServer.HttpsSession.
|
protectedvirtual |
Called when the complete HTTP request is received.
request | The received HTTP request. |
Reimplemented from XmobiTea.ProtonNetServer.HttpsSession.
|
protectedvirtual |
Called when an error occurs while receiving the HTTP request.
request | The HTTP request that caused the error. |
error | The error message. |
Reimplemented from XmobiTea.ProtonNetServer.HttpsSession.
|
protectedvirtual |
Called when the HTTP request headers are received.
request | The HTTP request containing the headers. |
Reimplemented from XmobiTea.ProtonNetServer.HttpsSession.
|
virtual |
Called when a WebSocket connection is closed.
buffer | The close data buffer. |
position | The starting position in the buffer. |
length | The length of the close data. |
status | The close status code. |
Implements XmobiTea.ProtonNetCommon.IWebSocket.
|
virtual |
Called when a WebSocket connection is successfully established.
request | The HTTP request for the WebSocket connection. |
Implements XmobiTea.ProtonNetCommon.IWebSocket.
Reimplemented in XmobiTea.ProtonNet.Server.Socket.Sessions.SocketWssSession.
|
virtual |
Called when a WebSocket connection is successfully established.
response | The HTTP response for the WebSocket connection. |
Implements XmobiTea.ProtonNetCommon.IWebSocket.
|
virtual |
Called when a WebSocket connection is being established.
request | The HTTP request for the WebSocket connection. |
Implements XmobiTea.ProtonNetCommon.IWebSocket.
|
virtual |
Called when a WebSocket connection is being established.
request | The HTTP request for the WebSocket connection. |
response | The HTTP response for the WebSocket connection. |
Implements XmobiTea.ProtonNetCommon.IWebSocket.
|
virtual |
Called when a WebSocket connection is successfully disconnected.
Implements XmobiTea.ProtonNetCommon.IWebSocket.
Reimplemented in XmobiTea.ProtonNet.Server.Socket.Sessions.SocketWssSession.
|
virtual |
Called when a WebSocket connection is being disconnected.
Implements XmobiTea.ProtonNetCommon.IWebSocket.
|
virtual |
Called when a WebSocket error occurs with a SocketError instance.
error | The SocketError that occurred. |
Implements XmobiTea.ProtonNetCommon.IWebSocket.
|
virtual |
Called when a WebSocket error occurs with a custom error message.
error | The error message. |
Implements XmobiTea.ProtonNetCommon.IWebSocket.
|
virtual |
Called when a WebSocket ping is received.
buffer | The ping data buffer. |
position | The starting position in the buffer. |
length | The length of the ping data. |
Implements XmobiTea.ProtonNetCommon.IWebSocket.
|
virtual |
Called when a WebSocket pong is received.
buffer | The pong data buffer. |
position | The starting position in the buffer. |
length | The length of the pong data. |
Implements XmobiTea.ProtonNetCommon.IWebSocket.
|
virtual |
Called when data is received from the WebSocket connection.
buffer | The received data buffer. |
position | The starting position in the buffer. |
length | The length of the received data. |
Implements XmobiTea.ProtonNetCommon.IWebSocket.
Reimplemented in XmobiTea.ProtonNet.Server.Socket.Sessions.SocketWssSession.
int XmobiTea.ProtonNetServer.WssSession.SendBinary | ( | byte[] | buffer | ) |
Sends a binary message synchronously to the WebSocket connection.
buffer | The buffer containing the binary message. |
Implements XmobiTea.ProtonNetServer.IWsSession.
int XmobiTea.ProtonNetServer.WssSession.SendBinary | ( | byte[] | buffer, |
int | position, | ||
int | length ) |
Sends a binary message synchronously to the WebSocket connection with a specified position and length.
buffer | The buffer containing the binary message. |
position | The starting position in the buffer. |
length | The length of the data to send. |
Implements XmobiTea.ProtonNetServer.IWsSession.
bool XmobiTea.ProtonNetServer.WssSession.SendBinaryAsync | ( | byte[] | buffer | ) |
Sends a binary message asynchronously to the WebSocket connection.
buffer | The buffer containing the binary message. |
Implements XmobiTea.ProtonNetServer.IWsSession.
bool XmobiTea.ProtonNetServer.WssSession.SendBinaryAsync | ( | byte[] | buffer, |
int | position, | ||
int | length ) |
Sends a binary message asynchronously to the WebSocket connection with a specified position and length.
buffer | The buffer containing the binary message. |
position | The starting position in the buffer. |
length | The length of the data to send. |
Implements XmobiTea.ProtonNetServer.IWsSession.
int XmobiTea.ProtonNetServer.WssSession.SendClose | ( | int | status, |
byte[] | buffer ) |
Sends a close frame synchronously to the WebSocket connection with the specified status code and buffer.
status | The close status code. |
buffer | The buffer containing additional data to send with the close frame. |
Implements XmobiTea.ProtonNetServer.IWsSession.
int XmobiTea.ProtonNetServer.WssSession.SendClose | ( | int | status, |
byte[] | buffer, | ||
int | position, | ||
int | length ) |
Sends a close frame synchronously to the WebSocket connection with the specified status code, buffer, position, and length.
status | The close status code. |
buffer | The buffer containing additional data to send with the close frame. |
position | The starting position in the buffer. |
length | The length of the data to send. |
Implements XmobiTea.ProtonNetServer.IWsSession.
bool XmobiTea.ProtonNetServer.WssSession.SendCloseAsync | ( | int | status, |
byte[] | buffer ) |
Sends a close frame asynchronously to the WebSocket connection with the specified status code and buffer.
status | The close status code. |
buffer | The buffer containing additional data to send with the close frame. |
Implements XmobiTea.ProtonNetServer.IWsSession.
bool XmobiTea.ProtonNetServer.WssSession.SendCloseAsync | ( | int | status, |
byte[] | buffer, | ||
int | position, | ||
int | length ) |
Sends a close frame asynchronously to the WebSocket connection with the specified status code, buffer, position, and length.
status | The close status code. |
buffer | The buffer containing additional data to send with the close frame. |
position | The starting position in the buffer. |
length | The length of the data to send. |
Implements XmobiTea.ProtonNetServer.IWsSession.
int XmobiTea.ProtonNetServer.WssSession.SendPing | ( | byte[] | buffer | ) |
Sends a ping frame synchronously to the WebSocket connection.
buffer | The buffer containing the ping frame. |
Implements XmobiTea.ProtonNetServer.IWsSession.
int XmobiTea.ProtonNetServer.WssSession.SendPing | ( | byte[] | buffer, |
int | position, | ||
int | length ) |
Sends a ping frame synchronously to the WebSocket connection with a specified position and length.
buffer | The buffer containing the ping frame. |
position | The starting position in the buffer. |
length | The length of the data to send. |
Implements XmobiTea.ProtonNetServer.IWsSession.
bool XmobiTea.ProtonNetServer.WssSession.SendPingAsync | ( | byte[] | buffer | ) |
Sends a ping frame asynchronously to the WebSocket connection.
buffer | The buffer containing the ping frame. |
Implements XmobiTea.ProtonNetServer.IWsSession.
bool XmobiTea.ProtonNetServer.WssSession.SendPingAsync | ( | byte[] | buffer, |
int | position, | ||
int | length ) |
Sends a ping frame asynchronously to the WebSocket connection with a specified position and length.
buffer | The buffer containing the ping frame. |
position | The starting position in the buffer. |
length | The length of the data to send. |
Implements XmobiTea.ProtonNetServer.IWsSession.
int XmobiTea.ProtonNetServer.WssSession.SendPong | ( | byte[] | buffer | ) |
Sends a pong frame synchronously to the WebSocket connection.
buffer | The buffer containing the pong frame. |
Implements XmobiTea.ProtonNetServer.IWsSession.
int XmobiTea.ProtonNetServer.WssSession.SendPong | ( | byte[] | buffer, |
int | position, | ||
int | length ) |
Sends a pong frame synchronously to the WebSocket connection with a specified position and length.
buffer | The buffer containing the pong frame. |
position | The starting position in the buffer. |
length | The length of the data to send. |
Implements XmobiTea.ProtonNetServer.IWsSession.
bool XmobiTea.ProtonNetServer.WssSession.SendPongAsync | ( | byte[] | buffer | ) |
Sends a pong frame asynchronously to the WebSocket connection.
buffer | The buffer containing the pong frame. |
Implements XmobiTea.ProtonNetServer.IWsSession.
bool XmobiTea.ProtonNetServer.WssSession.SendPongAsync | ( | byte[] | buffer, |
int | position, | ||
int | length ) |
Sends a pong frame asynchronously to the WebSocket connection with a specified position and length.
buffer | The buffer containing the pong frame. |
position | The starting position in the buffer. |
length | The length of the data to send. |
Implements XmobiTea.ProtonNetServer.IWsSession.
WssSession(WssServer server) int XmobiTea.ProtonNetServer.WssSession.SendText | ( | byte[] | buffer | ) |
Initializes a new instance of the WssSession class with the specified WebSocket server.
server | The WebSocket server. |
Sends a text message synchronously to the WebSocket connection.
buffer | The buffer containing the text message. |
Implements XmobiTea.ProtonNetServer.IWsSession.
int XmobiTea.ProtonNetServer.WssSession.SendText | ( | byte[] | buffer, |
int | position, | ||
int | length ) |
Sends a text message synchronously to the WebSocket connection with a specified position and length.
buffer | The buffer containing the text message. |
position | The starting position in the buffer. |
length | The length of the data to send. |
Implements XmobiTea.ProtonNetServer.IWsSession.
bool XmobiTea.ProtonNetServer.WssSession.SendTextAsync | ( | byte[] | buffer | ) |
Sends a text message asynchronously to the WebSocket connection.
buffer | The buffer containing the text message. |
Implements XmobiTea.ProtonNetServer.IWsSession.
bool XmobiTea.ProtonNetServer.WssSession.SendTextAsync | ( | byte[] | buffer, |
int | position, | ||
int | length ) |
Sends a text message asynchronously to the WebSocket connection with a specified position and length.
buffer | The buffer containing the text message. |
position | The starting position in the buffer. |
length | The length of the data to send. |
Implements XmobiTea.ProtonNetServer.IWsSession.
void XmobiTea.ProtonNetServer.WssSession.SendUpgrade | ( | HttpResponse | response | ) |
Sends a WebSocket upgrade response to the client.
response | The HTTP response containing the WebSocket upgrade information. |
Implements XmobiTea.ProtonNetCommon.IWebSocket.