From 05ef1ebafc04dcd5c73f66514fe3b4009c9eba18 Mon Sep 17 00:00:00 2001 From: Markus Mertama Date: Sun, 24 Mar 2024 16:55:15 +0200 Subject: [PATCH] Remove ui_ready from uWs server is_connected as that caused blocking Apitests --- gempyrelib/js/gempyre.js | 2 +- gempyrelib/src/gempyre_internal.cpp | 8 ++++++++ gempyrelib/src/uwebsockets/server.cpp | 2 +- test/mock_browser/ws_app.cpp | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/gempyrelib/js/gempyre.js b/gempyrelib/js/gempyre.js index 0bfaf0f8..47fcda21 100644 --- a/gempyrelib/js/gempyre.js +++ b/gempyrelib/js/gempyre.js @@ -781,7 +781,7 @@ socket.onopen = function(event) { // one guess is that in API tests there no events coming setTimeout(function() { socket.send(JSON.stringify({'type': 'event', - 'element': '', 'event': 'ui_ready'})); + 'element': '', 'event': 'ui_ready', 'properties':{}})); }, 100); socket.send(JSON.stringify({'type': 'ui_ready'})); diff --git a/gempyrelib/src/gempyre_internal.cpp b/gempyrelib/src/gempyre_internal.cpp index 16008096..285d870a 100644 --- a/gempyrelib/src/gempyre_internal.cpp +++ b/gempyrelib/src/gempyre_internal.cpp @@ -583,6 +583,14 @@ std::function GempyreInternal::makeCaller(const std::functionempty() && m_uiready; + return !m_broadcaster->empty() /*&& m_uiready*/; // why was this - } bool Uws_Server::beginBatch() { diff --git a/test/mock_browser/ws_app.cpp b/test/mock_browser/ws_app.cpp index 7ffd8270..6df46eb6 100644 --- a/test/mock_browser/ws_app.cpp +++ b/test/mock_browser/ws_app.cpp @@ -21,7 +21,7 @@ bool App::on_status(websocket::Status status) { const auto ready = Json({{"type", "ui_ready"}}).dump(); send_message(ready.c_str()); std::this_thread::sleep_for(10ms); - const auto event = Json({{"type", "event"}, {"element", ""}, {"event", "ui_ready"}}).dump(); + const auto event = Json({{"type", "event"}, {"element", ""}, {"event", "ui_ready"}, {"properties", Json::object()}}).dump(); send_message(event.c_str()); return true; }