|
ProtonNet Server 1.0
An Open Solution for all your socket or web api needs.
|
Represents a WebSocket session that inherits from HttpSession and implements WebSocket functionality. More...
Public Member Functions | |
| WsSession(WsServer server) int | SendText (byte[] buffer) |
| Initializes a new instance of the WsSession 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.HttpSession | |
| HttpSession (HttpServer server) | |
| Initializes a new instance of the HttpSession 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.TcpSession | |
| TcpSession (TcpServer server) | |
| Initializes a new instance of the TcpSession class. | |
| INetworkStatistics | GetNetworkStatistics () |
| Gets the network statistics for this session. | |
| virtual bool | Disconnect () |
| Disconnects the session. | |
| virtual int | Send (byte[] buffer) |
| Sends data synchronously. | |
| virtual int | Send (byte[] buffer, int position, int length) |
| Sends data synchronously with the specified position and length. | |
| virtual bool | SendAsync (byte[] buffer) |
| Sends data asynchronously. | |
| virtual bool | SendAsync (byte[] buffer, int position, int length) |
| Sends data asynchronously with the specified position and length. | |
| void | Dispose () |
| Releases all resources used by the current instance of the TcpSession class. | |
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.HttpSession | |
Protected Member Functions inherited from XmobiTea.ProtonNetServer.TcpSession | |
| virtual void | OnConnecting () |
| Invoked when the session is in the process of connecting. | |
| virtual void | OnConnected () |
| Invoked when the session has successfully connected. | |
| virtual void | OnSent (int sent, int pending) |
| Invoked when data is successfully sent to the remote endpoint. | |
| virtual void | OnEmpty () |
| Invoked when the send buffer is empty. | |
| virtual void | OnError (SocketError error) |
| Invoked when an error occurs during the session operation. | |
| virtual void | Dispose (bool disposingManagedResources) |
| Releases the unmanaged resources used by the TcpSession and optionally releases the managed resources. | |
Additional Inherited Members | |
Package Functions inherited from XmobiTea.ProtonNetServer.TcpSession | |
Properties inherited from XmobiTea.ProtonNetServer.HttpSession | |
| 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.TcpSession | |
| string | Id [get] |
| Gets the unique identifier for this session. | |
| TcpServer | Server [get] |
| Gets the server that owns this session. | |
| Socket | Socket [get] |
| Gets the socket associated with this session. | |
| bool | IsConnected [get] |
| Gets a value indicating whether the session is currently connected. | |
| bool | IsDisposed [get] |
| Gets a value indicating whether the session has been disposed. | |
| bool | IsSocketDisposed [get] |
| Gets a value indicating whether the socket has been disposed. | |
| TcpServerOptions | Options [get] |
| Gets the options for the TCP server. | |
Represents a WebSocket session that inherits from HttpSession and implements WebSocket functionality.
|
protectedvirtual |
Called when the session has been disconnected.
Reimplemented from XmobiTea.ProtonNetServer.HttpSession.
|
protectedvirtual |
Called when the session is disconnecting.
Reimplemented from XmobiTea.ProtonNetServer.TcpSession.
|
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.HttpSession.
|
protectedvirtual |
Called when the complete HTTP request is received.
| request | The received HTTP request. |
Reimplemented from XmobiTea.ProtonNetServer.HttpSession.
|
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.HttpSession.
|
protectedvirtual |
Called when the HTTP request headers are received.
| request | The HTTP request containing the headers. |
Reimplemented from XmobiTea.ProtonNetServer.HttpSession.
|
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.SocketWsSession.
|
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.SocketWsSession.
|
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.SocketWsSession.
| int XmobiTea.ProtonNetServer.WsSession.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.WsSession.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.WsSession.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.WsSession.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.WsSession.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.WsSession.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.WsSession.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.WsSession.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.WsSession.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.WsSession.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.WsSession.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.WsSession.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.WsSession.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.WsSession.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.WsSession.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.WsSession.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.
Initializes a new instance of the WsSession 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.WsSession.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.WsSession.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.WsSession.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.WsSession.SendUpgrade | ( | HttpResponse | response | ) |
Sends a WebSocket upgrade response to the client.
| response | The HTTP response containing the WebSocket upgrade information. |
Implements XmobiTea.ProtonNetCommon.IWebSocket.