Skip to content

Commit

Permalink
Twitch: fixed reconnection
Browse files Browse the repository at this point in the history
  • Loading branch information
3dproger committed Jun 16, 2023
1 parent a868bb8 commit 36feff9
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/chat_services/twitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static const QString TwitchIRCHost = "tmi.twitch.tv";
static const QString FolderLogs = "logs_twitch";
static const QString ClientID = OBFUSCATE(TWITCH_CLIENT_ID);

static const int ReconncectPeriod = 3 * 1000;
static const int ReconncectPeriod = 5 * 1000;
static const int PingPeriod = 60 * 1000;
static const int PongTimeout = 5 * 1000;
static const int UpdateStreamInfoPeriod = 10 * 1000;
Expand Down Expand Up @@ -73,7 +73,10 @@ Twitch::Twitch(QSettings& settings, const QString& settingsGroupPath, QNetworkAc

QObject::connect(&socket, &QWebSocket::textMessageReceived, this, &Twitch::onIRCMessage);

QObject::connect(&socket, &QWebSocket::connected, this, [this]() {
QObject::connect(&socket, &QWebSocket::connected, this, [this]()
{
//qDebug() << Q_FUNC_INFO << "webSocket connected";

if (state.connected)
{
state.connected = false;
Expand All @@ -95,6 +98,8 @@ Twitch::Twitch(QSettings& settings, const QString& settingsGroupPath, QNetworkAc

QObject::connect(&socket, &QWebSocket::disconnected, this, [this]()
{
//qDebug() << Q_FUNC_INFO << "webSocket disconnected";

if (state.connected)
{
state.connected = false;
Expand All @@ -111,7 +116,7 @@ Twitch::Twitch(QSettings& settings, const QString& settingsGroupPath, QNetworkAc

QObject::connect(&timerReconnect, &QTimer::timeout, this, [this]()
{
if (!enabled.get() || !auth.isLoggedIn())
if (!enabled.get())
{
return;
}
Expand Down

0 comments on commit 36feff9

Please sign in to comment.