Start a new HTTP server.
Start a new HTTP server.
the TCP port used. If set to 0, it starts on any available port. This is the default.
the ip address this server listen at. 0.0.0.0 means listening on all available address. This is the default.
if provided, the SSL configuration to use. In this case the server will listen for HTTPS requests.
the server options such as the number of IO thread to use.
the ExecutionContext to use to run user code.
a server instance that you can stop later.
Build and start HTTP servers.
Starting an HTTP server require a service function. The service function will be run on the provided ExecutionContext. This function should be non-blocking, but you can also decide to go with a blocking service if you provide an appropriate ExecutionContext (just note that if the ExecutionContext is fully blocked, the HTTP server is fully blocked).
The service function will be called by the server as soon as new HTTP request header has been received. The server also set up a lazy stream for the body. User code can pull from this stream and consume it if needed. Otherwise it will be drained after exchange completion (ie. when the response has been fully sent).
The response value returned by the servcie function will be transfered back to the client.