diff --git a/asio b/asio index 8087252..6e75b35 160000 --- a/asio +++ b/asio @@ -1 +1 @@ -Subproject commit 8087252a0c3c2f0baad96ddbd6554db17a846376 +Subproject commit 6e75b35cdf5b6195cf7fc6f15d54eb134e6de22c diff --git a/xfinal/connection.hpp b/xfinal/connection.hpp index e6b1a65..6a558d3 100644 --- a/xfinal/connection.hpp +++ b/xfinal/connection.hpp @@ -660,6 +660,7 @@ namespace xfinal { cancel_keep_timer(); auto ws = handler->router_.websokcets().start_webscoket(view2str(handler->req_.get_event_index_str())); ws->user_data_ = req_.move_user_data(); + ws->decode_url_params_ = req_.move_key_params (); ws->move_socket(std::move(handler->socket_)); } }); diff --git a/xfinal/http_handler.hpp b/xfinal/http_handler.hpp index 92bcc7a..56eb51a 100644 --- a/xfinal/http_handler.hpp +++ b/xfinal/http_handler.hpp @@ -473,6 +473,9 @@ namespace xfinal { std::map&& move_user_data() { return std::move(user_data_); } + std::map&& move_key_params () { + return std::move (decode_url_params_); + } private: nonstd::string_view method_; nonstd::string_view url_; diff --git a/xfinal/utils.hpp b/xfinal/utils.hpp index e63b86e..02c3f52 100644 --- a/xfinal/utils.hpp +++ b/xfinal/utils.hpp @@ -3,7 +3,7 @@ #include #include "string_view.hpp" #include -#include +#include "ghc/filesystem.hpp" #include #include "json.hpp" #include diff --git a/xfinal/websokcet.hpp b/xfinal/websokcet.hpp index ee009a8..d858a39 100644 --- a/xfinal/websokcet.hpp +++ b/xfinal/websokcet.hpp @@ -113,6 +113,9 @@ namespace xfinal { asio::ip::tcp::socket& socket() { return *socket_; } + std::map key_params () const noexcept { + return decode_url_params_; + } private: void move_socket(std::unique_ptr&& socket) { socket_ = std::move(socket); @@ -565,6 +568,7 @@ namespace xfinal { std::atomic_bool socket_is_open_{ false }; std::atomic_bool is_writing_{ false }; std::map user_data_; + std::map decode_url_params_; }; class websocket_hub {