Skip to content

Commit

Permalink
Fix websocket by changing the Crow routes order/priorities
Browse files Browse the repository at this point in the history
  • Loading branch information
orzechow committed Nov 8, 2024
1 parent 92bc3c4 commit 65cab4f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions gui/include/arbitration_graphs/gui/web_server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ class WebServer {
return response;
});

CROW_ROUTE(app_, "/<path>")
([this](std::string file_path_partial) {
crow::response response;
crow::utility::sanitize_filename(file_path_partial);
response.set_static_file_info_unsafe(static_directory_ + file_path_partial);
return response;
});

CROW_WEBSOCKET_ROUTE(app_, "/status")
.onopen([this](crow::websocket::connection& conn) {
std::lock_guard<std::mutex> guard(connections_mutex_);
Expand All @@ -49,6 +41,14 @@ class WebServer {
CROW_LOG_DEBUG << "Received message: " << message;
});

CROW_ROUTE(app_, "/<path>")
([this](std::string file_path_partial) {
crow::response response;
crow::utility::sanitize_filename(file_path_partial);
response.set_static_file_info_unsafe(static_directory_ + file_path_partial);
return response;
});

if (autostart_) {
// We need to store the std::future to run Crow asynchronously
_f = start();
Expand Down

0 comments on commit 65cab4f

Please sign in to comment.