diff options
| author | Stefan Boberg <[email protected]> | 2021-09-12 11:51:29 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-09-12 11:51:29 +0200 |
| commit | 822b0b1cb3868fdfc2b7159cdbf11c3df776c9dd (patch) | |
| tree | 7888b5017fdcd085103a60b14bff3efd5e7be7f3 /zenhttp/httpuws.cpp | |
| parent | Added gb benchmark tool for test script usage (diff) | |
| download | zen-822b0b1cb3868fdfc2b7159cdbf11c3df776c9dd.tar.xz zen-822b0b1cb3868fdfc2b7159cdbf11c3df776c9dd.zip | |
HttpResponse enum -> HttpResponseCode
Also removed initial CbPackage API HttpServer changes as I have decided to take a different approach
Diffstat (limited to 'zenhttp/httpuws.cpp')
| -rw-r--r-- | zenhttp/httpuws.cpp | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/zenhttp/httpuws.cpp b/zenhttp/httpuws.cpp index 2fb3734e8..992809b17 100644 --- a/zenhttp/httpuws.cpp +++ b/zenhttp/httpuws.cpp @@ -1,7 +1,9 @@ +// Copyright Epic Games, Inc. All Rights Reserved. + #include "httpuws.h" #pragma warning(push) -#pragma warning(disable : 4244 4267 4458 4706) +#pragma warning(disable : 4244 4324 4267 4458 4706) #include <uwebsockets/App.h> #pragma warning(pop) @@ -42,12 +44,25 @@ HttpUwsServer::Run(bool TestMode) zen::logging::ConsoleLog().info("Zen Server running (null HTTP). Press ESC or Q to quit"); } - ::uWS::App().get("/*", [](uWS::HttpResponse<false>* res, uWS::HttpRequest* req) { - res->end("Hello world!"); - ZEN_UNUSED(req); - }).listen(m_BasePort, [](auto* listen_socket) { - ZEN_UNUSED(listen_socket); - }).run(); + ::uWS::App() + .get("/*", + [](uWS::HttpResponse<false>* res, uWS::HttpRequest* req) { + res->end("Hello world!"); + ZEN_UNUSED(req); + }) + .post("/*", + [](uWS::HttpResponse<false>* res, uWS::HttpRequest* req) { + res->onData([&](std::string_view Data, bool fin) { + ZEN_UNUSED(Data); + if (fin) + res->end("Hello world!"); + }); + + res->onAborted([&] {}); + ZEN_UNUSED(req); + }) + .listen(m_BasePort, [](auto* listen_socket) { ZEN_UNUSED(listen_socket); }) + .run(); do { |