Provides a simple HTTP server that allows to accept the WebSocket connection requests.
The HttpServer class provides the multi WebSocket service.
The HttpServer class needs the application configuration file to configure the server root path.
xml Example |
<?xml version="1.0" encoding="utf-8"?> <configuration> <appSettings> <add key="RootPath" value="./Public" /> </appSettings> </configuration> |
See Also: Inherited members from object.
|
HttpServer
()
|
Initializes a new instance of the WebSocketSharp.Server.HttpServer class that listens for incoming requests on port 80. |
|
Initializes a new instance of the WebSocketSharp.Server.HttpServer class that listens for incoming requests on the specified port. |
[read-only] | Port | int . Gets the port on which to listen for incoming requests. |
[read-only] | ServicePaths | IEnumerable<string> . Gets the collection of paths associated with the every WebSocket services that the server provides. |
|
Sweeped | bool . Gets or sets a value indicating whether the server cleans up the inactive WebSocket service instances periodically. |
|
AddWebSocketService<T>
(string)Adds the specified type WebSocket service. |
|
|
GetFile
(string)Gets the contents of the specified file. |
|
|
Start
()Starts the WebSocketSharp.Server.HttpServer. |
|
|
Stop
()Shuts down the WebSocketSharp.Server.HttpServer. |
|
OnConnect | Occurs when the server receives an HTTP CONNECT request. |
|
OnDelete | Occurs when the server receives an HTTP DELETE request. |
|
OnError | Occurs when the server gets an error. |
|
OnGet | Occurs when the server receives an HTTP GET request. |
|
OnHead | Occurs when the server receives an HTTP HEAD request. |
|
OnOptions | Occurs when the server receives an HTTP OPTIONS request. |
|
OnPatch | Occurs when the server receives an HTTP PATCH request. |
|
OnPost | Occurs when the server receives an HTTP POST request. |
|
OnPut | Occurs when the server receives an HTTP PUT request. |
|
OnTrace | Occurs when the server receives an HTTP TRACE request. |
Initializes a new instance of the WebSocketSharp.Server.HttpServer class that listens for incoming requests on port 80.
Syntax
public HttpServer ()Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp.Server
Assembly: websocket-sharp (in websocket-sharp.dll)
Initializes a new instance of the WebSocketSharp.Server.HttpServer class that listens for incoming requests on the specified port.
Syntax
public HttpServer (int port)Parameters
- port
- An int that contains a port number.
Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp.Server
Assembly: websocket-sharp (in websocket-sharp.dll)
Adds the specified type WebSocket service.
Syntax
public void AddWebSocketService<T> (string absPath)
where T : WebSocketSharp.Server.WebSocketService, new()Type Parameters
- T
- The type of the WebSocket service. The T must inherit the WebSocketSharp.Server.WebSocketService class.
Parameters
- absPath
- A string that contains an absolute path associated with the WebSocket service.
Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp.Server
Assembly: websocket-sharp (in websocket-sharp.dll)
Gets the contents of the specified file.
Syntax
Parameters
- path
- A string that contains a virtual path to the file to get.
Returns
An array of byte that contains the contents of the file.Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp.Server
Assembly: websocket-sharp (in websocket-sharp.dll)
Occurs when the server receives an HTTP CONNECT request.
Syntax
public event EventHandler<HttpRequestEventArgs> OnConnectRemarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp.Server
Assembly: websocket-sharp (in websocket-sharp.dll)
Occurs when the server receives an HTTP DELETE request.
Syntax
public event EventHandler<HttpRequestEventArgs> OnDeleteRemarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp.Server
Assembly: websocket-sharp (in websocket-sharp.dll)
Occurs when the server gets an error.
Syntax
public event EventHandler<WebSocketSharp.ErrorEventArgs> OnErrorRemarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp.Server
Assembly: websocket-sharp (in websocket-sharp.dll)
Occurs when the server receives an HTTP GET request.
Syntax
public event EventHandler<HttpRequestEventArgs> OnGetRemarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp.Server
Assembly: websocket-sharp (in websocket-sharp.dll)
Occurs when the server receives an HTTP HEAD request.
Syntax
public event EventHandler<HttpRequestEventArgs> OnHeadRemarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp.Server
Assembly: websocket-sharp (in websocket-sharp.dll)
Occurs when the server receives an HTTP OPTIONS request.
Syntax
public event EventHandler<HttpRequestEventArgs> OnOptionsRemarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp.Server
Assembly: websocket-sharp (in websocket-sharp.dll)
Occurs when the server receives an HTTP PATCH request.
Syntax
public event EventHandler<HttpRequestEventArgs> OnPatchRemarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp.Server
Assembly: websocket-sharp (in websocket-sharp.dll)
Occurs when the server receives an HTTP POST request.
Syntax
public event EventHandler<HttpRequestEventArgs> OnPostRemarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp.Server
Assembly: websocket-sharp (in websocket-sharp.dll)
Occurs when the server receives an HTTP PUT request.
Syntax
public event EventHandler<HttpRequestEventArgs> OnPutRemarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp.Server
Assembly: websocket-sharp (in websocket-sharp.dll)
Occurs when the server receives an HTTP TRACE request.
Syntax
public event EventHandler<HttpRequestEventArgs> OnTraceRemarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp.Server
Assembly: websocket-sharp (in websocket-sharp.dll)
Gets the port on which to listen for incoming requests.
Syntax
public int Port { get; }Value
An int that contains a port number.Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp.Server
Assembly: websocket-sharp (in websocket-sharp.dll)
Gets the collection of paths associated with the every WebSocket services that the server provides.
Syntax
public IEnumerable<string> ServicePaths { get; }Value
An IEnumerable<string> that contains the collection of paths.Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp.Server
Assembly: websocket-sharp (in websocket-sharp.dll)
Starts the WebSocketSharp.Server.HttpServer.
Syntax
public void Start ()Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp.Server
Assembly: websocket-sharp (in websocket-sharp.dll)
Shuts down the WebSocketSharp.Server.HttpServer.
Syntax
public void Stop ()Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp.Server
Assembly: websocket-sharp (in websocket-sharp.dll)
Gets or sets a value indicating whether the server cleans up the inactive WebSocket service instances periodically.
Syntax
public bool Sweeped { get; set; }Value
true if the server cleans up the inactive WebSocket service instances every 60 seconds; otherwise, false. The default value is true.Remarks
Documentation for this section has not yet been entered.Requirements
Namespace: WebSocketSharp.Server
Assembly: websocket-sharp (in websocket-sharp.dll)