Loading relayserver/RelayServer.cpp +15 −8 Original line number Diff line number Diff line Loading @@ -72,13 +72,14 @@ int RelayServer::Run() h.onMessage([](uWS::WebSocket<uWS::SERVER> *ws, char *message, size_t length, uWS::OpCode opCode) { auto *con = static_cast<WebsocketConnection*>(ws->getUserData()); if (length>MAX_CLIENT_MESSAGE_SIZE) { ws->close(413, "payload to large"); return; } try { auto *con = static_cast<WebsocketConnection*>(ws->getUserData()); std::string s(message, length); json data = json::parse(s, nullptr, false); if (!data.is_object()) { return; } Loading @@ -88,6 +89,12 @@ int RelayServer::Run() std::string key = data["viewer_key"]; con->setViewerKey(static_cast<uint64_t>(std::stol(key))); } } catch (std::exception e) { ws->close(418, "invalid request"); return; } }); std::string response = "Hello!"; Loading Loading
relayserver/RelayServer.cpp +15 −8 Original line number Diff line number Diff line Loading @@ -72,13 +72,14 @@ int RelayServer::Run() h.onMessage([](uWS::WebSocket<uWS::SERVER> *ws, char *message, size_t length, uWS::OpCode opCode) { auto *con = static_cast<WebsocketConnection*>(ws->getUserData()); if (length>MAX_CLIENT_MESSAGE_SIZE) { ws->close(413, "payload to large"); return; } try { auto *con = static_cast<WebsocketConnection*>(ws->getUserData()); std::string s(message, length); json data = json::parse(s, nullptr, false); if (!data.is_object()) { return; } Loading @@ -88,6 +89,12 @@ int RelayServer::Run() std::string key = data["viewer_key"]; con->setViewerKey(static_cast<uint64_t>(std::stol(key))); } } catch (std::exception e) { ws->close(418, "invalid request"); return; } }); std::string response = "Hello!"; Loading