Class HttpServer
Provides an lightweight HTTP server powered by Sisk.
public sealed class HttpServer : IDisposable
- Inheritance
-
HttpServer
- Implements
- Inherited Members
Constructors
- HttpServer()
Creates an new HttpServer instance with no predefined configuration.
- HttpServer(HttpServerConfiguration)
Creates a new default configuration HttpServer instance with the given Route and server configuration.
Properties
- EventSources
Gets an HttpEventSourceCollection with active event source connections in this HTTP server.
- IsDynamicCodeSupported
Gets an bool indicating if the current environment supports dynamic code or it's running in an AOT assembly.
- IsListening
Gets an boolean indicating if this HTTP server is running and listening.
- IsSupported
Gets an bool indicating if Sisk can be used with the current environment.
- ListeningPrefixes
Gets an string array containing all URL prefixes which this HTTP server is listening to.
- PoweredBy
Gets the X-Powered-By Sisk header value.
- ServerConfiguration
Gets or sets the Server Configuration object.
- SiskVersion
Gets the current Sisk version.
- WebSockets
Gets an HttpWebSocketConnectionCollection with active Web Sockets connections in this HTTP server.
Methods
- CreateBuilder()
Builds an empty HttpServerHostContext context.
- CreateBuilder(Action<HttpServerHostContextBuilder>)
Builds an HttpServerHostContext context invoking the handler on it.
- CreateBuilder(string)
Builds an empty HttpServerHostContext context with predefined listening host string.
- CreateBuilder(ushort)
Builds an empty HttpServerHostContext context with predefined listening port.
- CreateListener()
Gets an listening and running HTTP server in an random port.
- CreateListener(ushort)
Gets an listening and running HTTP server in the specified port.
- CreateListener(ushort, out HttpServerConfiguration, out ListeningHost, out Router)
Gets an listening and running HTTP server in the specified port.
- Dispose()
Invalidates this class and releases the resources used by it, and permanently closes the HTTP server.
- Emit(ushort, out HttpServerConfiguration, out ListeningHost, out Router)
Gets an non-listening HTTP server with configuration, listening host, and router.
- RegisterHandler(HttpServerHandler)
Associate an HttpServerHandler in this HttpServer to handle functions such as requests, routers and contexts.
- RegisterHandler<T>()
Associate an HttpServerHandler in this HttpServer to handle functions such as requests, routers and contexts.
- Restart()
Restarts this HTTP server, sending all processing responses and starting them again, reading the listening ports again.
- Start()
Starts listening to the set port and handling requests on this server.
- Stop()
Stops the server from listening and stops the request handler.
- WaitNext(CancellationToken)
Waits for the next HTTP request to be processed, with a specified cancellation token.
- WaitNext(TimeSpan)
Waits for the next HTTP request to be processed, with a specified timeout.
- WaitNextAsync(CancellationToken)
Asynchronously waits for the next HTTP request to be processed, with a specified cancellation token.
- WaitNextAsync(TimeSpan)
Asynchronously waits for the next HTTP request to be processed, with a specified timeout.
English
Русский
Português
Español
Deutsch
中文 (简体)
日本語