1
0
Fork 0
mirror of https://github.com/HenkKalkwater/harbour-sailfin.git synced 2025-09-04 01:42:44 +00:00

core/WebSocket: Delay websocket initialisation

Workaround for #16.
This commit is contained in:
Chris Josten 2024-01-02 15:36:19 +01:00
parent 3fb373a8ef
commit bb45637d0b
5 changed files with 110 additions and 38 deletions

View file

@ -44,7 +44,10 @@ WebSocket::WebSocket(ApiClient *client)
connect(client, &ApiClient::authenticatedChanged, this, [this](bool isAuthenticated) {
if (isAuthenticated) {
this->m_reconnectAttempt = 0;
this->open();
// https://github.com/heartfin/harbour-sailfin/issues/16
// Opening a websocket just afther the authentication may cause the application to freeze
// Therefore, we delay the initialisation :)
QTimer::singleShot(5'000, this, &WebSocket::open);
}
});
}