5 #include <boost/any.hpp> 10 namespace fc {
namespace http {
24 virtual void send_message(
const std::string& message ) = 0;
25 virtual void close( int64_t code,
const std::string& reason ){};
26 void on_message(
const std::string& message ) { _on_message(message); }
35 virtual std::string get_request_header(
const std::string& key) = 0;
43 boost::any _session_data;
44 std::function<void(const std::string&)> _on_message;
45 std::function<fc::http::reply(const std::string&)> _on_http;
59 void on_connection(
const on_connection_handler& handler);
60 void listen( uint16_t port );
62 uint16_t get_listening_port();
65 void stop_listening();
70 std::unique_ptr<detail::websocket_server_impl> my;
80 const std::string& ssl_password,
81 const std::string& forward_header_key );
84 void on_connection(
const on_connection_handler& handler);
85 void listen( uint16_t port );
87 uint16_t get_listening_port();
90 void stop_listening();
95 std::unique_ptr<detail::websocket_tls_server_impl> my;
104 websocket_connection_ptr
connect(
const std::string& uri );
105 websocket_connection_ptr secure_connect(
const std::string& uri );
108 void synchronous_close();
109 void append_header(
const std::string& key,
const std::string& value);
111 std::unique_ptr<detail::websocket_client_impl> my;
112 std::unique_ptr<detail::websocket_tls_client_impl> smy;
void on_message_handler(const std::function< void(const std::string &)> &h)
void on_message(const std::string &message)
virtual void close(int64_t code, const std::string &reason)
boost::any & get_session_data()
void connect(AsyncSocket &sock, const EndpointType &ep)
wraps boost::asio::socket::async_connect
std::shared_ptr< websocket_connection > websocket_connection_ptr
fc::signal< void()> closed
fc::http::reply on_http(const std::string &message)
std::function< void(const websocket_connection_ptr &)> on_connection_handler
void set_session_data(boost::any d)
std::string _remote_endpoint
virtual ~websocket_connection()
void on_http_handler(const std::function< fc::http::reply(const std::string &)> &h)
std::vector< header > headers
const std::string & get_remote_endpoint_string() const
boost::signals2::signal< T > signal