From dae7f7b9539b03ea63cc474bd8449163aaaee172 Mon Sep 17 00:00:00 2001 From: pichotm <8015411+PichotM@users.noreply.github.com> Date: Wed, 24 Jul 2024 11:46:22 +0200 Subject: [PATCH] feat(net): support dynamic server endpoints using handover --- code/components/net/src/NetLibrary.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/code/components/net/src/NetLibrary.cpp b/code/components/net/src/NetLibrary.cpp index 1e244ba0db..23ec133621 100644 --- a/code/components/net/src/NetLibrary.cpp +++ b/code/components/net/src/NetLibrary.cpp @@ -1192,7 +1192,7 @@ concurrency::task NetLibrary::ConnectToServer(const std::string& rootUrl) m_connectionState = CS_IDLE; return true; } - + auto rawEndpoints = (node.find("endpoints") != node.end()) ? node["endpoints"] : json{}; auto continueAfterEndpoints = [=, capNode = node](const json& capEndpointsJson) @@ -1206,6 +1206,14 @@ concurrency::task NetLibrary::ConnectToServer(const std::string& rootUrl) // gather endpoints std::vector endpoints; + if (!node["handover"].is_null()) + { + if (!node["handover"]["endpoints"].is_null()) + { + endpointsJson = node["handover"]["endpoints"]; + } + } + if (!endpointsJson.is_null() && !endpointsJson.is_boolean()) { for (const auto& endpoint : endpointsJson)