1 #ifndef CPP_WEB_SERVER_WEBSOCKET_CONNECTION_HPP 2 #define CPP_WEB_SERVER_WEBSOCKET_CONNECTION_HPP 7 #include <boost/asio.hpp> 8 #include <boost/enable_shared_from_this.hpp> 9 #include <boost/noncopyable.hpp> 10 #include <boost/shared_ptr.hpp> 11 #include <boost/thread/mutex.hpp> 16 class WebsocketHttpRequestHandler;
27 :
public boost::enable_shared_from_this<WebsocketConnection>,
28 private boost::noncopyable
33 typedef boost::function<void(const WebsocketMessage& message)>
44 const char* begin,
const char* end);
45 void handle_read(
const char* begin,
const char* end);
boost::function< void(const WebsocketMessage &message)> MessageHandler
HttpConnectionPtr connection_
bool sendPingMessage(const std::string &content="")
boost::shared_ptr< WebsocketConnection > WebsocketConnectionPtr
boost::shared_ptr< HttpConnection > HttpConnectionPtr
WebsocketFrameBuffer frame_buffer_
WebsocketFrameParser frame_parser_
void handle_read(const char *begin, const char *end)
WebsocketMessage message_
static void static_handle_read(WebsocketConnectionWeakPtr weak_this, const char *begin, const char *end)
boost::weak_ptr< WebsocketConnection > WebsocketConnectionWeakPtr
bool sendMessage(const WebsocketMessage &message)
bool sendFrame(WebsocketFrame &frame)
void set_message_handler(MessageHandler &handler)
WebsocketConnection(HttpConnectionPtr connection)
bool sendTextMessage(const std::string &content)