Final framework, now just cleanup

This commit is contained in:
Aaron Kimbre
2025-01-28 13:58:29 -06:00
parent ddd9ff273e
commit aedc8a09fe
6 changed files with 136 additions and 77 deletions

View File

@@ -28,8 +28,8 @@ struct HTTPRoute {
std::function<void(HTTPReply&, const std::string&)> handle;
};
struct WSAction {
std::string action;
struct WSEvent {
std::string name;
std::function<void(mg_connection*, nlohmann::json)> handle;
};
@@ -44,10 +44,11 @@ public:
Web();
~Web();
void ReceiveRequests();
void static SendWSMessage(std::string sub, const std::string& message);
void static SendWSMessage(std::string sub, nlohmann::json& message);
bool Startup(const std::string& listen_ip, const uint32_t listen_port);
void RegisterHTTPRoute(HTTPRoute route);
void RegisterWSAction(WSAction action);
void RegisterWSEvent(WSEvent event);
void RegisterWSSubscription(const std::string& subscription);
private:
mg_mgr mgr;
};