|
ProtonNet Server 1.0
An Open Solution for all your socket or web api needs.
|
An implement of interface WebSocket. More...
Public Member Functions | |
| WebSocket (IWebSocket originWs) | |
| Initializes a new instance of the WebSocket class with the specified origin WebSocket. | |
| bool | PerformClientUpgrade (HttpResponse response, string id) |
| Performs the WebSocket client upgrade. | |
| bool | PerformServerUpgrade (HttpRequest request, HttpResponse response) |
| Performs the WebSocket server upgrade. | |
| void | PrepareSendFrame (byte opcode, bool mask, byte[] buffer, int position, int length, int status=0) |
| Prepares the WebSocket frame to be sent. | |
| void | PrepareReceiveFrame (byte[] buffer, int position, int length) |
| Prepares the WebSocket frame received for processing. | |
| void | ClearWsBuffers () |
| Clears the WebSocket buffers. | |
| void | InitWsNonce () |
| Initializes the WebSocket nonce with random bytes. | |
| void | OnWsConnecting (HttpRequest request) |
| Invoked when a WebSocket connection is being established. | |
| void | OnWsConnected (HttpResponse response) |
| Invoked when a WebSocket connection has been successfully established. | |
| bool | OnWsConnecting (HttpRequest request, HttpResponse response) |
| Invoked when a WebSocket connection is being established, allowing to modify the response. | |
| void | OnWsConnected (HttpRequest request) |
| Invoked when a WebSocket connection has been successfully established. | |
| void | OnWsDisconnecting () |
| Invoked when a WebSocket connection is about to be closed. | |
| void | OnWsDisconnected () |
| Invoked when a WebSocket connection has been closed. | |
| void | OnWsReceived (byte[] buffer, int position, int length) |
| Invoked when a WebSocket message has been received. | |
| void | OnWsClose (byte[] buffer, int position, int length, int status=1000) |
| Invoked when a WebSocket close frame has been received. | |
| void | OnWsPing (byte[] buffer, int position, int length) |
| Invoked when a WebSocket ping frame has been received. | |
| void | OnWsPong (byte[] buffer, int position, int length) |
| Invoked when a WebSocket pong frame has been received. | |
| void | OnWsError (string error) |
| Invoked when a WebSocket error occurs, providing an error message. | |
| void | OnWsError (SocketError error) |
| Invoked when a WebSocket error occurs, providing a SocketError. | |
| void | SendUpgrade (HttpResponse response) |
| Sends an HTTP response to complete the WebSocket upgrade process. | |
Public Member Functions inherited from XmobiTea.ProtonNetCommon.IWebSocket | |
Properties | |
| bool | handshaked [get, set] |
| Indicates whether the WebSocket handshake has been completed. | |
| object | sendLock [get] |
| The lock object used to synchronize access to the send buffer. | |
| IMemoryBuffer | sendBuffer [get] |
| The buffer used to store the WebSocket frame to be sent. | |
| byte[] | nonce [get] |
| The nonce used during the WebSocket handshake. | |
An implement of interface WebSocket.
| XmobiTea.ProtonNetCommon.WebSocket.WebSocket | ( | IWebSocket | originWs | ) |
| void XmobiTea.ProtonNetCommon.WebSocket.OnWsClose | ( | byte[] | buffer, |
| int | position, | ||
| int | length, | ||
| int | status = 1000 ) |
Invoked when a WebSocket close frame has been received.
| buffer | The buffer containing the close frame data. |
| position | The position in the buffer where the data starts. |
| length | The length of the close frame data. |
| status | The close status code. |
Implements XmobiTea.ProtonNetCommon.IWebSocket.
| void XmobiTea.ProtonNetCommon.WebSocket.OnWsConnected | ( | HttpRequest | request | ) |
Invoked when a WebSocket connection has been successfully established.
| request | The HTTP request initiating the connection. |
Implements XmobiTea.ProtonNetCommon.IWebSocket.
| void XmobiTea.ProtonNetCommon.WebSocket.OnWsConnected | ( | HttpResponse | response | ) |
Invoked when a WebSocket connection has been successfully established.
| response | The HTTP response confirming the connection. |
Implements XmobiTea.ProtonNetCommon.IWebSocket.
| void XmobiTea.ProtonNetCommon.WebSocket.OnWsConnecting | ( | HttpRequest | request | ) |
Invoked when a WebSocket connection is being established.
| request | The HTTP request initiating the connection. |
Implements XmobiTea.ProtonNetCommon.IWebSocket.
| bool XmobiTea.ProtonNetCommon.WebSocket.OnWsConnecting | ( | HttpRequest | request, |
| HttpResponse | response ) |
Invoked when a WebSocket connection is being established, allowing to modify the response.
| request | The HTTP request initiating the connection. |
| response | The HTTP response confirming the connection. |
Implements XmobiTea.ProtonNetCommon.IWebSocket.
| void XmobiTea.ProtonNetCommon.WebSocket.OnWsDisconnected | ( | ) |
Invoked when a WebSocket connection has been closed.
Implements XmobiTea.ProtonNetCommon.IWebSocket.
| void XmobiTea.ProtonNetCommon.WebSocket.OnWsDisconnecting | ( | ) |
Invoked when a WebSocket connection is about to be closed.
Implements XmobiTea.ProtonNetCommon.IWebSocket.
| void XmobiTea.ProtonNetCommon.WebSocket.OnWsError | ( | SocketError | error | ) |
Invoked when a WebSocket error occurs, providing a SocketError.
| error | The SocketError that occurred. |
Implements XmobiTea.ProtonNetCommon.IWebSocket.
| void XmobiTea.ProtonNetCommon.WebSocket.OnWsError | ( | string | error | ) |
Invoked when a WebSocket error occurs, providing an error message.
| error | The error message. |
Implements XmobiTea.ProtonNetCommon.IWebSocket.
| void XmobiTea.ProtonNetCommon.WebSocket.OnWsPing | ( | byte[] | buffer, |
| int | position, | ||
| int | length ) |
Invoked when a WebSocket ping frame has been received.
| buffer | The buffer containing the ping frame data. |
| position | The position in the buffer where the data starts. |
| length | The length of the ping frame data. |
Implements XmobiTea.ProtonNetCommon.IWebSocket.
| void XmobiTea.ProtonNetCommon.WebSocket.OnWsPong | ( | byte[] | buffer, |
| int | position, | ||
| int | length ) |
Invoked when a WebSocket pong frame has been received.
| buffer | The buffer containing the pong frame data. |
| position | The position in the buffer where the data starts. |
| length | The length of the pong frame data. |
Implements XmobiTea.ProtonNetCommon.IWebSocket.
| void XmobiTea.ProtonNetCommon.WebSocket.OnWsReceived | ( | byte[] | buffer, |
| int | position, | ||
| int | length ) |
Invoked when a WebSocket message has been received.
| buffer | The buffer containing the received data. |
| position | The position in the buffer where the data starts. |
| length | The length of the received data. |
Implements XmobiTea.ProtonNetCommon.IWebSocket.
| bool XmobiTea.ProtonNetCommon.WebSocket.PerformClientUpgrade | ( | HttpResponse | response, |
| string | id ) |
| bool XmobiTea.ProtonNetCommon.WebSocket.PerformServerUpgrade | ( | HttpRequest | request, |
| HttpResponse | response ) |
Performs the WebSocket server upgrade.
| request | The HTTP request initiating the upgrade. |
| response | The HTTP response for the upgrade. |
| void XmobiTea.ProtonNetCommon.WebSocket.PrepareReceiveFrame | ( | byte[] | buffer, |
| int | position, | ||
| int | length ) |
Prepares the WebSocket frame received for processing.
| buffer | The buffer containing the received frame. |
| position | The position in the buffer where the data starts. |
| length | The length of the received data. |
| void XmobiTea.ProtonNetCommon.WebSocket.PrepareSendFrame | ( | byte | opcode, |
| bool | mask, | ||
| byte[] | buffer, | ||
| int | position, | ||
| int | length, | ||
| int | status = 0 ) |
Prepares the WebSocket frame to be sent.
| opcode | The operation code of the WebSocket frame. |
| mask | Indicates whether the frame should be masked. |
| buffer | The buffer containing the data to be sent. |
| position | The position in the buffer where the data starts. |
| length | The length of the data to be sent. |
| status | The status code for the frame, if applicable. |
| void XmobiTea.ProtonNetCommon.WebSocket.SendUpgrade | ( | HttpResponse | response | ) |
Sends an HTTP response to complete the WebSocket upgrade process.
| response | The HTTP response to be sent. |
Implements XmobiTea.ProtonNetCommon.IWebSocket.