Async Http Server. More...
#include <HttpAsyncServer.h>
Public Member Functions | |
| template<typename T , typename = typename TypeTraits::EnableIf<TypeTraits::IsBaseOf<HttpAsyncConnectionBase, T>::value>::type> | |
| Result | init (Span< T > clients) |
| Initializes the async server with all needed memory buffers. | |
| template<typename T , typename = typename TypeTraits::EnableIf<TypeTraits::IsBaseOf<HttpAsyncConnectionBase, T>::value>::type> | |
| Result | resize (Span< T > clients) |
| Result | close () |
| Closes the server, removing references to the memory buffers passed during init. | |
| Result | start (AsyncEventLoop &loop, StringSpan address, uint16_t port) |
| Starts the http server on the given AsyncEventLoop, address and port. | |
| Result | stop () |
| Stops http server asynchronously pushing cancel and close requests to the event loop. | |
| bool | isStarted () const |
| Returns true if the server has been started. | |
| const HttpConnectionsPool & | getConnections () const |
Public Attributes | |
| Function< void(HttpConnection &)> | onRequest |
| Called after enough data from a newly connected client has arrived, causing all headers to be parsed. | |
Async Http Server.
This class handles a fully asynchronous http server staying inside 5 fixed memory regions passed during init.
Usage:
| Result SC::HttpAsyncServer::close | ( | ) |
Closes the server, removing references to the memory buffers passed during init.
|
inline |
Initializes the async server with all needed memory buffers.
|
inlinenodiscard |
Returns true if the server has been started.
| Result SC::HttpAsyncServer::start | ( | AsyncEventLoop & | loop, |
| StringSpan | address, | ||
| uint16_t | port ) |
Starts the http server on the given AsyncEventLoop, address and port.
| loop | The event loop to be used, where to add the listening socket |
| address | The address of local interface where to listen to |
| port | The local port where to start listening to |
| Result SC::HttpAsyncServer::stop | ( | ) |
Stops http server asynchronously pushing cancel and close requests to the event loop.
| Function<void(HttpConnection&)> SC::HttpAsyncServer::onRequest |
Called after enough data from a newly connected client has arrived, causing all headers to be parsed.