|
tgbot-cpp
|
This class handles HTTP requests from the Internet. More...
#include <HttpServer.h>
Public Types | |
| using | ServerHandler = std::function<std::string(const std::string&, const std::unordered_map<std::string, std::string>&)> |
| using | ErrorHandler = std::function<void(const std::exception&)> |
Public Member Functions | |
| HttpServer (const typename boost::asio::basic_socket_acceptor< Protocol >::endpoint_type &endpoint, ServerHandler handler) | |
| void | start (const ErrorHandler &errorHandler={ }, std::initializer_list< int > signals={ SIGINT, SIGTERM }) |
| Starts receiving connections until stop() is called or one of the configured signals is received. | |
| void | stop () |
| Stops receiving new connections. Connections already accepted are completed. | |
This class handles HTTP requests from the Internet.
Definition at line 27 of file HttpServer.h.
| using TgBot::HttpServer< Protocol >::ErrorHandler = std::function<void(const std::exception&)> |
Definition at line 30 of file HttpServer.h.
| using TgBot::HttpServer< Protocol >::ServerHandler = std::function<std::string(const std::string&, const std::unordered_map<std::string, std::string>&)> |
Definition at line 29 of file HttpServer.h.
|
inline |
Definition at line 32 of file HttpServer.h.
|
inline |
Starts receiving connections until stop() is called or one of the configured signals is received.
| errorHandler | Called when receiving or handling a request fails. |
| signals | Process signals that stop the server. Pass an empty list to disable signal handling. |
Definition at line 43 of file HttpServer.h.
|
inline |
Stops receiving new connections. Connections already accepted are completed.
Definition at line 72 of file HttpServer.h.