From 0cf6f461b682e936dac05b882bdd5b7799f3afe3 Mon Sep 17 00:00:00 2001 From: pravin-battu Date: Thu, 2 Jul 2020 13:34:29 -0300 Subject: [PATCH] websocket fix, issue 13 --- include/fc/network/http/websocket.hpp | 9 +++++++++ src/network/http/websocket.cpp | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/include/fc/network/http/websocket.hpp b/include/fc/network/http/websocket.hpp index a42c1f8..01ed677 100755 --- a/include/fc/network/http/websocket.hpp +++ b/include/fc/network/http/websocket.hpp @@ -41,6 +41,9 @@ namespace fc { namespace http { typedef std::function on_connection_handler; + // Recommended changes in the future + // TODO websocket_tls_server and websocket_server have almost the same interface and implementation, + // better refactor to remove duplicate code and to avoid undesired or unnecessary differences class websocket_server { public: @@ -59,6 +62,9 @@ namespace fc { namespace http { }; + // Recommended changes in the future + // TODO websocket_tls_server and websocket_server have almost the same interface and implementation, + // better refactor to remove duplicate code and to avoid undesired or unnecessary differences class websocket_tls_server { public: @@ -70,6 +76,9 @@ namespace fc { namespace http { void listen( uint16_t port ); void listen( const fc::ip::endpoint& ep ); void start_accept(); + uint16_t get_listening_port(); + void stop_listening(); + void close(); private: friend class detail::websocket_tls_server_impl; diff --git a/src/network/http/websocket.cpp b/src/network/http/websocket.cpp index 6440dd6..3463b95 100755 --- a/src/network/http/websocket.cpp +++ b/src/network/http/websocket.cpp @@ -1,3 +1,4 @@ + #include #include #include @@ -733,4 +734,4 @@ namespace fc { namespace http { return my->_connection; } FC_CAPTURE_AND_RETHROW( (uri) ) } -} } // fc::http +} } // fc::http \ No newline at end of file