fixes for wasm client

- ui_enum
- spdlog pthread
- url hostname from emscripten
- websocket ping pong not exposed on js
- version string in client
- cleanup the generation of the version string
- set fixed path for wasm ws
This commit is contained in:
2026-06-12 13:07:04 +02:00
parent 5495e20b1e
commit d08fd90e63
8 changed files with 52 additions and 21 deletions
+17 -7
View File
@@ -22,6 +22,22 @@ Web_socket_wrapper::Web_socket_wrapper(const QUrl &url, QObject *parent)
emit on_connected();
});
connect(m_web_socket, &QWebSocket::disconnected, this, [=, this] { emit on_closed(); });
connect(m_web_socket, &QWebSocket::errorOccurred, this, [this](QAbstractSocket::SocketError error) {
LOG_ERROR(QString::fromStdString(std::string(magic_enum::enum_name(error))));
});
connect(m_ping_timer, &QTimer::timeout, this, [=, this] {
#ifdef EMSCRIPTEN
if (m_web_socket->state() != QAbstractSocket::ConnectedState)
{
m_web_socket->close();
emit on_closed();
}
m_ping_timer->start(1000);
});
#else
m_web_socket->ping();
m_pong_timer->start(1000);
});
connect(m_web_socket, &QWebSocket::pong, this, [=, this](quint64 elapsedTime) {
if (elapsedTime > 1000)
{
@@ -32,18 +48,12 @@ Web_socket_wrapper::Web_socket_wrapper(const QUrl &url, QObject *parent)
m_pong_timer->stop();
m_ping_timer->start(1000);
});
connect(m_web_socket, &QWebSocket::errorOccurred, this, [this](QAbstractSocket::SocketError error) {
LOG_ERROR(QString::fromStdString(std::string(magic_enum::enum_name(error))));
});
connect(m_ping_timer, &QTimer::timeout, this, [=, this] {
m_web_socket->ping();
m_pong_timer->start(1000);
});
connect(m_pong_timer, &QTimer::timeout, this, [=, this] {
LOG_CRITICAL("Pong timeout");
m_web_socket->close();
emit on_closed();
});
#endif
m_ping_timer->setSingleShot(true);
m_pong_timer->setSingleShot(true);
m_web_socket->setProxy(QNetworkProxy::NoProxy);