00001 #ifndef CPP_WEB_SERVER_WEBSOCKET_REQUEST_HANDLER_HPP 00002 #define CPP_WEB_SERVER_WEBSOCKET_REQUEST_HANDLER_HPP 00003 00004 #include <boost/function.hpp> 00005 #include <boost/shared_ptr.hpp> 00006 #include "async_web_server_cpp/http_request_handler.hpp" 00007 #include "async_web_server_cpp/websocket_connection.hpp" 00008 00009 namespace async_web_server_cpp 00010 { 00011 00012 class WebsocketConnection; 00013 00014 typedef boost::function<WebsocketConnection::MessageHandler(const HttpRequest &, boost::shared_ptr<WebsocketConnection>)> WebsocketRequestHandler; 00015 00019 class WebsocketHttpRequestHandler 00020 { 00021 public: 00022 WebsocketHttpRequestHandler(WebsocketRequestHandler handler); 00023 bool operator()(const HttpRequest &request, boost::shared_ptr<HttpConnection> connection, const char* begin, const char* end); 00024 00025 static const std::string KEY_MAGIC_STRING; 00026 private: 00027 WebsocketRequestHandler handler_; 00028 }; 00029 00030 } 00031 00032 #endif