Table of Contents

Class HttpServer

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

Provides an lightweight HTTP server powered by Sisk.

public sealed class HttpServer : IDisposable
Inheritance
HttpServer
Implements
Inherited Members

Constructors

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()

Waits for the next execution result from the server. This method obtains the next completed context from the HTTP server, both with the request and its response. This method does not interrupt the asynchronous processing of requests.

WaitNextAsync()

Waits for the next execution result from the server asynchronously. This method obtains the next completed context from the HTTP server, both with the request and its response. This method does not interrupt the asynchronous processing of requests.