23 #ifndef TGBOT_TGHTTPSERVER_H 24 #define TGBOT_TGHTTPSERVER_H 33 template<
typename Protocol>
39 TgWebhookServer(std::shared_ptr<boost::asio::basic_socket_acceptor<Protocol>> acceptor,
const std::string& path,
const EventHandler* eventHandler) :
40 HttpServer<Protocol>(acceptor, [this, eventHandler, &path](const std::string& data, const std::map<std::string, std::string>& headers) -> std::string {
41 if (headers.at(
"method") ==
"POST" && headers.at(
"path") == path) {
49 TgWebhookServer(std::shared_ptr<boost::asio::basic_socket_acceptor<Protocol>> acceptor,
const std::string& path,
const Bot& bot) :
57 #endif //TGBOT_TGHTTPSERVER_H TgWebhookServer(std::shared_ptr< boost::asio::basic_socket_acceptor< Protocol >> acceptor, const std::string &path, const Bot &bot)
static TgTypeParser & getInstance()
TgWebhookServer(std::shared_ptr< boost::asio::basic_socket_acceptor< Protocol >> acceptor, const std::string &path, const EventHandler *eventHandler)
TgWebhookServer(std::shared_ptr< boost::asio::basic_socket_acceptor< Protocol >> acceptor, const typename HttpServer< Protocol >::ServerHandler &handler)=delete
std::string generateResponse(const std::string &data, const std::string &mimeType="text/plain", short unsigned statusCode=200, const std::string &statusStr="OK", bool isKeepAlive=false)
static HttpParser & getInstance()
std::function< std::string(const std::string &, const std::map< std::string, std::string >)> ServerHandler
void handleUpdate(const Update::Ptr &update) const