Sisk

Class

HttpServer

Namespace
Sisk.Core.Http
Assembly
Sisk.Core.dll

Provides an lightweight HTTP server powered by Sisk.

C#
public sealed class HttpServer : IDisposable

Inheritance #

object ← HttpServer

Implements #

IDisposable

Inherited Members #

object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Constructors #

NameDescription
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 #

NameDescription
EventSourcesGets an HttpEventSourceCollection with active event source connections in this HTTP server.
IsDynamicCodeSupportedGets an Boolean indicating if the current environment supports dynamic code or it’s running in an AOT assembly.
IsListeningGets an boolean indicating if this HTTP server is running and listening.
IsSupportedGets an Boolean indicating if Sisk can be used with the current environment.
ListeningPrefixesGets an string array containing all URL prefixes which this HTTP server is listening to.
PoweredByGets the X-Powered-By Sisk header value.
ServerConfigurationGets or sets the Server Configuration object.
SiskVersionGets the current Sisk version.
WebSocketsGets an HttpWebSocketConnectionCollection with active Web Sockets connections in this HTTP server.

Methods #

NameDescription
CreateBuilder(Action<HttpServerHostContextBuilder>)Builds an HttpServerHostContext context invoking the handler on it.
CreateBuilder(ushort)Builds an empty HttpServerHostContext context with predefined listening port.
CreateBuilder(string)Builds an empty HttpServerHostContext context with predefined listening host string.
CreateBuilder()Builds an empty HttpServerHostContext context.
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.
HandleContext(HttpServerEngineContext)Handles a single HttpServerEngineContext request.
RegisterHandler<T>()Associate an HttpServerHandler in this HttpServer to handle functions such as requests, routers and contexts.
RegisterHandler(HttpServerHandler)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(TimeSpan)Waits for the next HTTP request to be processed, with a specified timeout.
WaitNext(CancellationToken)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.
WaitNextAsync(CancellationToken)Asynchronously waits for the next HTTP request to be processed, with a specified cancellation token.

Type to search the documentation and the API reference.